[breaking change] Popup: add lockScroll instead of lockOnScroll & preventScroll (#688)

This commit is contained in:
neverland
2018-03-14 11:07:48 +08:00
committed by GitHub
parent 7d3768591f
commit d36dd61bc9
12 changed files with 33 additions and 61 deletions
-4
View File
@@ -62,10 +62,6 @@ export default create({
closeOnClickOverlay: {
type: Boolean,
default: false
},
lockOnScroll: {
type: Boolean,
default: true
}
},
+1 -1
View File
@@ -34,7 +34,7 @@ Dialog.defaultOptions = {
title: '',
message: '',
overlay: true,
lockOnScroll: true,
lockScroll: true,
confirmButtonText: '',
cancelButtonText: '',
showConfirmButton: true,
+7 -15
View File
@@ -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);
}
-4
View File
@@ -21,10 +21,6 @@ export default create({
type: Boolean,
default: true
},
lockOnScroll: {
type: Boolean,
default: false
},
closeOnClickOverlay: {
type: Boolean,
default: true
-2
View File
@@ -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"
>