From e841cbd8fb912c96f9714f1e2ab74784f9e5b27c Mon Sep 17 00:00:00 2001 From: wujie <1795139763@qq.com> Date: Thu, 7 Jun 2018 09:19:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?loadmore.vue=20=20touchmove=20=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=20=E6=96=B0=E5=A2=9E=20=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E7=BA=B5=E5=90=91=E6=BB=91=E5=8A=A8=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E6=AD=A4=E7=BB=84=E4=BB=B6=E5=92=8C=20swipe.vue=20?= =?UTF-8?q?=E6=B7=B7=E5=90=88=E4=BD=BF=E7=94=A8=E6=97=B6=E6=8A=96=E5=8A=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/loadmore/src/loadmore.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/loadmore/src/loadmore.vue b/packages/loadmore/src/loadmore.vue index 431b7318..c4ab2a27 100644 --- a/packages/loadmore/src/loadmore.vue +++ b/packages/loadmore/src/loadmore.vue @@ -132,8 +132,10 @@ bottomDropped: false, bottomReached: false, direction: '', + startX: 0, startY: 0, startScrollTop: 0, + currentX: 0, currentY: 0, topStatus: '', bottomStatus: '' @@ -273,6 +275,7 @@ }, handleTouchStart(event) { + this.startX = event.touches[0].clientX; this.startY = event.touches[0].clientY; this.startScrollTop = this.getScrollTop(this.scrollEventTarget); this.bottomReached = false; @@ -290,7 +293,14 @@ if (this.startY < this.$el.getBoundingClientRect().top && this.startY > this.$el.getBoundingClientRect().bottom) { return; } - this.currentY = event.touches[0].clientY; + let touchesEvent = event.touches[0]; + this.currentX = touchesEvent.clientX; + this.currentY = touchesEvent.clientY; + let moveX = Math.abs(this.currentX - this.startX) + let moveY = Math.abs(this.currentY - this.startY) + if (moveX * 2 > moveY) { + return; + } let distance = (this.currentY - this.startY) / this.distanceIndex; this.direction = distance > 0 ? 'down' : 'up'; if (typeof this.topMethod === 'function' && this.direction === 'down' && From 40f6d7c1ca446c6849c699b63c755636a475e7fd Mon Sep 17 00:00:00 2001 From: wujie <1795139763@qq.com> Date: Thu, 7 Jun 2018 10:46:55 +0800 Subject: [PATCH 2/3] eslint-disable radix --- packages/loadmore/src/loadmore.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/loadmore/src/loadmore.vue b/packages/loadmore/src/loadmore.vue index c4ab2a27..c0c0bcf5 100644 --- a/packages/loadmore/src/loadmore.vue +++ b/packages/loadmore/src/loadmore.vue @@ -57,6 +57,7 @@