diff --git a/pages/template/custom-long-list/README.md b/pages/template/custom-long-list/README.md index 2fb5433cc7cbba41666fd1e34667c64357af0626..bdd857170a1b07759b6b89f4352863540fefed96 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 4b8faf9ccd46a610035ef793d20a33ab4fa3bea4..53bc3a31e66dfef9c0a46b37975a8198d402fea2 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