From 8ae39fe5b1c5f918d35e7b85c28927eded6ef3e9 Mon Sep 17 00:00:00 2001 From: zyronon Date: Fri, 17 Dec 2021 00:56:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96slide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/test/slide.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/pages/test/slide.js b/src/pages/test/slide.js index de4cde1..9cbac19 100644 --- a/src/pages/test/slide.js +++ b/src/pages/test/slide.js @@ -126,14 +126,34 @@ export default class Slide { this.isDrawDown = this.moveYDistance < 0 + // console.log('isDrawDown', this.isDrawDown) + + if (this.isDrawDown) { + if (this.index === this.getList().length - 1) { + this.css(this.slideList, 'transform', `translate3d(0px, ${ + this.getHeight() + (Math.abs(this.moveYDistance) > this.height / 5 ? -this.height / 5 : this.moveYDistance) + }px, 0px)`) + return + } + } else { + if (this.index === 0) return + } + this.css(this.slideList, 'transform', `translate3d(0px, ${ this.getHeight() + this.moveYDistance + (this.isDrawDown ? this.judgeValue : -this.judgeValue) }px, 0px)`) } - touchend() { + if (this.isDrawDown) { + if (this.index === this.getList().length - 1) { + console.log('加载中') + this.loading = true + return + } + } + let canSlide = this.height / 8 < Math.abs(this.moveYDistance); if (Date.now() - this.startTime < 40) canSlide = false