[breaking change] Popup: add lockScroll instead of lockOnScroll & preventScroll (#688)
This commit is contained in:
@@ -62,10 +62,6 @@ export default create({
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
lockOnScroll: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Dialog.defaultOptions = {
|
||||
title: '',
|
||||
message: '',
|
||||
overlay: true,
|
||||
lockOnScroll: true,
|
||||
lockScroll: true,
|
||||
confirmButtonText: '',
|
||||
cancelButtonText: '',
|
||||
showConfirmButton: true,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,6 @@ export default create({
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
lockOnScroll: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
v-if="!isSkuEmpty"
|
||||
v-model="show"
|
||||
position="bottom"
|
||||
lock-on-scroll
|
||||
prevent-scroll
|
||||
:close-on-click-overlay="closeOnClickOverlay"
|
||||
:get-container="getContainer"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user