From 488f7f1847cd1c61d57282ff5367a523ea137991 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Fri, 29 Mar 2024 11:20:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=95=BF=E5=88=97=E8=A1=A8=E7=BC=96=E8=AF=91=E5=88=B0?= =?UTF-8?q?=E5=AE=89=E5=8D=93=E6=8A=A5=E9=94=99=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/custom-long-list/README.md | 2 +- pages/template/custom-long-list/custom-list-view.uvue | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/template/custom-long-list/README.md b/pages/template/custom-long-list/README.md index 2fb5433c..bdd85717 100644 --- a/pages/template/custom-long-list/README.md +++ b/pages/template/custom-long-list/README.md @@ -6,7 +6,7 @@ [点击下载&安装]() ::: -uni-recycle-view 组件用于在展示超长列表时优化内存占用以及性能。不同于uni-app list-view组件,uni-recycle-view组件不会对所有数据循环创建VNode。适用于仅使用一个for循环创建所有列表项的场景。 +uni-recycle-view 组件用于在展示超长列表时优化内存占用以及初次加载时的速度。不同于uni-app list-view组件,uni-recycle-view组件不会对所有数据循环创建VNode。适用于仅使用一个for循环创建所有列表项的场景。 ### 基本用法 diff --git a/pages/template/custom-long-list/custom-list-view.uvue b/pages/template/custom-long-list/custom-list-view.uvue index 4b8faf9c..53bc3a31 100644 --- a/pages/template/custom-long-list/custom-list-view.uvue +++ b/pages/template/custom-long-list/custom-list-view.uvue @@ -101,7 +101,7 @@ }, flush() { const queueLength = this.rearrangeQueue.length - if (queueLength === 0) { + if (queueLength == 0) { return } const lastScrollTop = this.rearrangeQueue[queueLength - 1] @@ -109,10 +109,12 @@ this.rearrangeQueue = [] as number[] }, rearrange(scrollTop : number) { - const offsetStart = this.offsetThreshold[0] = Math.max(scrollTop - this.scrollElementHeight * 5, 0) + this.offsetThreshold[0] = Math.max(scrollTop - this.scrollElementHeight * 5, 0) this.offsetThreshold[1] = Math.max(scrollTop - this.scrollElementHeight * 3, 0) this.offsetThreshold[2] = Math.min(scrollTop + this.scrollElementHeight * 4, this.placeholderHeight) - const offsetEnd =this.offsetThreshold[3] = Math.min(scrollTop + this.scrollElementHeight * 6, this.placeholderHeight) + this.offsetThreshold[3] = Math.min(scrollTop + this.scrollElementHeight * 6, this.placeholderHeight) + const offsetStart = this.offsetThreshold[0] + const offsetEnd =this.offsetThreshold[3] const items = [] as any[] const defaultItemSize = this.defaultItemSize const cachedSize = this.cachedSize -- GitLab