Merge pull request #3808 from m430/bug-3792
fix bug #3792 Page scroll bar problem caused by Modal component
This commit is contained in:
commit
273cc057e6
1 changed files with 9 additions and 3 deletions
|
@ -13,6 +13,10 @@ export default {
|
|||
this.scrollBarWidth = getScrollBarSize();
|
||||
}
|
||||
},
|
||||
checkMaskInVisible () {
|
||||
let masks = document.getElementsByClassName('ivu-modal-mask') || [];
|
||||
return Array.from(masks).every(m => m.style.display === 'none' || m.classList.contains('fade-leave-to'));
|
||||
},
|
||||
setScrollBar () {
|
||||
if (this.bodyIsOverflowing && this.scrollBarWidth !== undefined) {
|
||||
document.body.style.paddingRight = `${this.scrollBarWidth}px`;
|
||||
|
@ -27,8 +31,10 @@ export default {
|
|||
document.body.style.overflow = 'hidden';
|
||||
},
|
||||
removeScrollEffect() {
|
||||
document.body.style.overflow = '';
|
||||
this.resetScrollBar();
|
||||
if (this.checkMaskInVisible()) {
|
||||
document.body.style.overflow = '';
|
||||
this.resetScrollBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue