From b378b660fefa49acb1a9986adf28d299a28a9609 Mon Sep 17 00:00:00 2001 From: Zero <339369805@qq.com> Date: Tue, 30 Oct 2018 16:18:55 +0800 Subject: [PATCH] Loadmore throw error with cancelable=false When use both :top-method and :bottom-method in loadmore.vue. Touchmove event handler function 'handleTouchMove()' throw error. Ignored attempt to cancel a touchmove event with cancelable=false. Fix it with event.cancelable. --- packages/loadmore/src/loadmore.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/loadmore/src/loadmore.vue b/packages/loadmore/src/loadmore.vue index 431b7318..f483b487 100644 --- a/packages/loadmore/src/loadmore.vue +++ b/packages/loadmore/src/loadmore.vue @@ -295,7 +295,9 @@ this.direction = distance > 0 ? 'down' : 'up'; if (typeof this.topMethod === 'function' && this.direction === 'down' && this.getScrollTop(this.scrollEventTarget) === 0 && this.topStatus !== 'loading') { - event.preventDefault(); + if (event.cancelable) { + event.preventDefault(); + } event.stopPropagation(); if (this.maxDistance > 0) { this.translate = distance <= this.maxDistance ? distance - this.startScrollTop : this.translate; @@ -313,7 +315,9 @@ } if (typeof this.bottomMethod === 'function' && this.direction === 'up' && this.bottomReached && this.bottomStatus !== 'loading' && !this.bottomAllLoaded) { - event.preventDefault(); + if (event.cancelable) { + event.preventDefault(); + } event.stopPropagation(); if (this.maxDistance > 0) { this.translate = Math.abs(distance) <= this.maxDistance