Commit 1635ec373c4f9f8f7c4f25dc2c548a4a1a072f79

Authored by ้ƒ‘ๆ•
1 parent ed4bb143

fix bug #3792 Page scroll bar problem caused by Modal component

Showing 1 changed file with 9 additions and 3 deletions   Show diff stats
src/components/modal/mixins-scrollbar.js
... ... @@ -13,6 +13,10 @@ export default {
13 13 this.scrollBarWidth = getScrollBarSize();
14 14 }
15 15 },
  16 + checkMaskInVisible () {
  17 + let masks = document.getElementsByClassName('ivu-modal-mask') || [];
  18 + return Array.from(masks).every(m => m.style.display === 'none' || m.classList.contains('fade-leave-to'));
  19 + },
16 20 setScrollBar () {
17 21 if (this.bodyIsOverflowing && this.scrollBarWidth !== undefined) {
18 22 document.body.style.paddingRight = `${this.scrollBarWidth}px`;
... ... @@ -27,8 +31,10 @@ export default {
27 31 document.body.style.overflow = 'hidden';
28 32 },
29 33 removeScrollEffect() {
30   - document.body.style.overflow = '';
31   - this.resetScrollBar();
  34 + if (this.checkMaskInVisible()) {
  35 + document.body.style.overflow = '';
  36 + this.resetScrollBar();
  37 + }
32 38 }
33 39 }
34   -};
35 40 \ No newline at end of file
  41 +};
... ...