From e4fb373881e39e7ced35d95c02ac21cc2a481d7f Mon Sep 17 00:00:00 2001 From: ZXLee Date: Mon, 25 Nov 2024 21:02:30 +0800 Subject: [PATCH] =?UTF-8?q?v0.3.1-scrollToTop=E3=80=81scrollToBottom?= =?UTF-8?q?=E3=80=81scrollToY=E6=B7=BB=E5=8A=A0=E6=98=AF=E5=90=A6=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=BB=9A=E5=8A=A8=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/z-paging-x/z-paging-x.uvue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/z-paging-x/uni_modules/z-paging-x/components/z-paging-x/z-paging-x.uvue b/z-paging-x/uni_modules/z-paging-x/components/z-paging-x/z-paging-x.uvue index 59cd352..3817294 100644 --- a/z-paging-x/uni_modules/z-paging-x/components/z-paging-x/z-paging-x.uvue +++ b/z-paging-x/uni_modules/z-paging-x/components/z-paging-x/z-paging-x.uvue @@ -373,7 +373,7 @@ by ZXLee this.totalData = []; } if (this.scrollToTopWhenReload) { - this.scrollToTop(); + this.scrollToTop(false); } this._emitQuery(this.pageNo, this.defaultPageSize); }, @@ -448,16 +448,17 @@ by ZXLee this.isLoading = false; }, // 滚动到顶部 - scrollToTop() { - this.scrollToY(0); + scrollToTop(animate: boolean) { + this.scrollToY(0, animate); this._checkShouldShowBackToTop(0); }, // 滚动到底部 - scrollToBottom() { - this.scrollToY(99999999); + scrollToBottom(animate: boolean) { + this.scrollToY(99999999, animate); }, // 滚动到指定位置,y为与顶部的距离,单位为px - scrollToY(y: number) { + scrollToY(y: number, animate: boolean) { + this.privateScrollWithAnimation = animate ? 1 : 0; this.scrollTop = this.oldScrollTop; this.$nextTick(() => { this.scrollTop = y; @@ -553,7 +554,7 @@ by ZXLee }, //处理滚动到顶部 _handleToTop() { - this.scrollToTop(); + this.scrollToTop(true); }, } }