From ee4d54c24ff33176378ebd752e8640792d943989 Mon Sep 17 00:00:00 2001 From: hdx Date: Mon, 4 Sep 2023 17:46:48 +0800 Subject: [PATCH] =?UTF-8?q?long-list:=20=E8=B0=83=E6=95=B4=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/long-list/long-list-page.uvue | 13 +++++-------- pages/template/long-list/long-list.uvue | 6 ++++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pages/template/long-list/long-list-page.uvue b/pages/template/long-list/long-list-page.uvue index 2a752576..7bdc4df2 100644 --- a/pages/template/long-list/long-list-page.uvue +++ b/pages/template/long-list/long-list-page.uvue @@ -99,15 +99,12 @@ } }, methods: { - refreshData() { + refreshData(loadComplete : (() => void) | null) { this.dataList.length = 0 this.$currentPage = 1 - this.loadData(() => { - // TODO - uni.stopPullDownRefresh() - }) + this.loadData(loadComplete) }, - loadData(oncomplete : (() => void) | null) { + loadData(loadComplete : (() => void) | null) { if (this.loading || this.isEnded) { return } @@ -139,8 +136,8 @@ }, complete: () => { this.loading = false - if (oncomplete != null) { - oncomplete() + if (loadComplete != null) { + loadComplete() } } }) diff --git a/pages/template/long-list/long-list.uvue b/pages/template/long-list/long-list.uvue index 71c52ac9..1af15922 100644 --- a/pages/template/long-list/long-list.uvue +++ b/pages/template/long-list/long-list.uvue @@ -98,7 +98,9 @@ this.setSwiperIndex(0, true) }, onPullDownRefresh() { - (this.$refs["longPage"]! as ComponentPublicInstance[])[this.swiperIndex].$callMethod('refreshData') + (this.$refs["longPage"]! as ComponentPublicInstance[])[this.swiperIndex].$callMethod('refreshData', () => { + uni.stopPullDownRefresh() + }) }, methods: { // TODO @@ -210,7 +212,7 @@ initSwiperItemData(index : number) { if (!this.swiperList[index].preload) { this.swiperList[index].preload = true; - (this.$refs["longPage"]! as ComponentPublicInstance[])[index].$callMethod('loadData') + (this.$refs["longPage"]! as ComponentPublicInstance[])[index].$callMethod('loadData', null) } } } -- GitLab