mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 20:18:22 +08:00
21 lines
593 B
TypeScript
21 lines
593 B
TypeScript
import getScrollBarSize from './getScrollBarSize';
|
|
|
|
export default close => {
|
|
const bodyIsOverflowing =
|
|
document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) &&
|
|
window.innerWidth > document.body.offsetWidth;
|
|
if (!bodyIsOverflowing) {
|
|
return;
|
|
}
|
|
if (close) {
|
|
document.body.style.position = '';
|
|
document.body.style.width = '';
|
|
return;
|
|
}
|
|
const scrollBarSize = getScrollBarSize();
|
|
if (scrollBarSize) {
|
|
document.body.style.position = 'relative';
|
|
document.body.style.width = `calc(100% - ${scrollBarSize}px)`;
|
|
}
|
|
};
|