mirror of https://github.com/ElemeFE/element
Popup: fix missing padding-right when overflow-y is scroll
parent
018931a74f
commit
7753bd8931
|
@ -2,6 +2,7 @@ import Vue from 'vue';
|
||||||
import merge from 'element-ui/src/utils/merge';
|
import merge from 'element-ui/src/utils/merge';
|
||||||
import PopupManager from 'element-ui/src/utils/popup/popup-manager';
|
import PopupManager from 'element-ui/src/utils/popup/popup-manager';
|
||||||
import getScrollBarWidth from '../scrollbar-width';
|
import getScrollBarWidth from '../scrollbar-width';
|
||||||
|
import { getStyle } from '../dom';
|
||||||
|
|
||||||
let idSeed = 1;
|
let idSeed = 1;
|
||||||
const transitions = [];
|
const transitions = [];
|
||||||
|
@ -198,7 +199,8 @@ export default {
|
||||||
}
|
}
|
||||||
scrollBarWidth = getScrollBarWidth();
|
scrollBarWidth = getScrollBarWidth();
|
||||||
let bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
|
let bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
|
||||||
if (scrollBarWidth > 0 && bodyHasOverflow) {
|
let bodyOverflowY = getStyle(document.body, 'overflowY');
|
||||||
|
if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll')) {
|
||||||
document.body.style.paddingRight = scrollBarWidth + 'px';
|
document.body.style.paddingRight = scrollBarWidth + 'px';
|
||||||
}
|
}
|
||||||
document.body.style.overflow = 'hidden';
|
document.body.style.overflow = 'hidden';
|
||||||
|
|
Loading…
Reference in New Issue