Skip to content

Commit

Permalink
[bugfix] Popup: should remove touch event listener when distroyed (yo…
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Apr 23, 2018
1 parent cbdaaf4 commit d92edf8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/mixins/popup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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);
}
}

Expand Down

0 comments on commit d92edf8

Please sign in to comment.