fix bug #3792 Page scroll bar problem caused by Modal component
This commit is contained in:
parent
ed4bb14303
commit
1635ec373c
1 changed files with 9 additions and 3 deletions
|
@ -13,6 +13,10 @@ export default {
|
||||||
this.scrollBarWidth = getScrollBarSize();
|
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 () {
|
setScrollBar () {
|
||||||
if (this.bodyIsOverflowing && this.scrollBarWidth !== undefined) {
|
if (this.bodyIsOverflowing && this.scrollBarWidth !== undefined) {
|
||||||
document.body.style.paddingRight = `${this.scrollBarWidth}px`;
|
document.body.style.paddingRight = `${this.scrollBarWidth}px`;
|
||||||
|
@ -27,8 +31,10 @@ export default {
|
||||||
document.body.style.overflow = 'hidden';
|
document.body.style.overflow = 'hidden';
|
||||||
},
|
},
|
||||||
removeScrollEffect() {
|
removeScrollEffect() {
|
||||||
|
if (this.checkMaskInVisible()) {
|
||||||
document.body.style.overflow = '';
|
document.body.style.overflow = '';
|
||||||
this.resetScrollBar();
|
this.resetScrollBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
Loading…
Add table
Reference in a new issue