[bugfix] Popup: should remove touch event listener when distroyed (#912)

This commit is contained in:
neverland 2018-04-23 13:07:19 +08:00 committed by GitHub
parent cbdaaf4b7a
commit d92edf871e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,10 +88,10 @@ export default {
this.renderOverlay();
if (this.lockScroll) {
on(document, 'touchstart', this.touchStart);
on(document, 'touchmove', this.onTouchMove);
if (!context.lockCount) {
document.body.classList.add('van-overflow-hidden');
on(document, 'touchstart', this.touchStart);
on(document, 'touchmove', this.onTouchMove);
}
context.lockCount++;
}
@ -104,10 +104,10 @@ export default {
if (this.lockScroll) {
context.lockCount--;
off(document, 'touchstart', this.touchStart);
off(document, 'touchmove', this.onTouchMove);
if (!context.lockCount) {
document.body.classList.remove('van-overflow-hidden');
off(document, 'touchstart', this.touchStart);
off(document, 'touchmove', this.onTouchMove);
}
}