add lockScroll in msgbox and dialog

This commit is contained in:
Leopoldthecoder
2016-10-02 21:14:43 +08:00
parent 73c50502f2
commit b7208300a1
10 changed files with 28 additions and 14 deletions

View File

@@ -43,6 +43,9 @@
modal: {
default: true
},
lockScroll: {
default: true
},
showClose: {
type: Boolean,
default: true
@@ -79,14 +82,16 @@
this.onClose && this.onClose();
setTimeout(() => {
if (this.modal && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
}, 200);
if (this.lockScroll) {
setTimeout(() => {
if (this.modal && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
}, 200);
}
this.opened = false;
if (!this.transition) {