[breaking change] Popup: add lockScroll instead of lockOnScroll & preventScroll (#688)
This commit is contained in:
@@ -17,12 +17,10 @@ export default {
|
||||
closeOnClickOverlay: Boolean,
|
||||
// z-index
|
||||
zIndex: [String, Number],
|
||||
// prevent touchmove scroll
|
||||
preventScroll: Boolean,
|
||||
// return the mount node for popup
|
||||
getContainer: Function,
|
||||
// prevent body scroll
|
||||
lockOnScroll: {
|
||||
lockScroll: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
@@ -118,20 +116,17 @@ export default {
|
||||
className: this.overlayClass,
|
||||
customStyle: this.overlayStyle
|
||||
});
|
||||
}
|
||||
|
||||
if (this.lockOnScroll) {
|
||||
document.body.classList.add('van-overflow-hidden');
|
||||
}
|
||||
if (this.lockScroll) {
|
||||
document.body.classList.add('van-overflow-hidden');
|
||||
on(document, 'touchstart', this.recordPosition);
|
||||
on(document, 'touchmove', this.watchTouchMove);
|
||||
}
|
||||
|
||||
this.$el.style.zIndex = context.plusKey('zIndex');
|
||||
this.$emit('input', true);
|
||||
this.opened = true;
|
||||
|
||||
if (this.preventScroll) {
|
||||
on(document, 'touchstart', this.recordPosition);
|
||||
on(document, 'touchmove', this.watchTouchMove);
|
||||
}
|
||||
},
|
||||
|
||||
close() {
|
||||
@@ -147,11 +142,8 @@ export default {
|
||||
doAfterClose() {
|
||||
manager.close(this._popupId);
|
||||
|
||||
if (this.lockOnScroll) {
|
||||
if (this.lockScroll) {
|
||||
document.body.classList.remove('van-overflow-hidden');
|
||||
}
|
||||
|
||||
if (this.preventScroll) {
|
||||
off(document, 'touchstart', this.recordPosition);
|
||||
off(document, 'touchmove', this.watchTouchMove);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user