Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
4fa1ffd4
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6018
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4fa1ffd4
编写于
3月 28, 2024
作者:
dcloud_wdl
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "perf: 优化长列表示例性能"
This reverts commit
3e0e5947
.
上级
dbf25262
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
9 addition
and
23 deletion
+9
-23
pages/template/custom-long-list/custom-list-view.uvue
pages/template/custom-long-list/custom-list-view.uvue
+9
-23
未找到文件。
pages/template/custom-long-list/custom-list-view.uvue
浏览文件 @
4fa1ffd4
...
@@ -109,39 +109,25 @@
...
@@ -109,39 +109,25 @@
this.rearrangeQueue = [] as number[]
this.rearrangeQueue = [] as number[]
},
},
rearrange(scrollTop : 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[1] = Math.max(scrollTop - this.scrollElementHeight * 3, 0)
this.offsetThreshold[2] = Math.min(scrollTop + this.scrollElementHeight * 4, this.placeholderHeight)
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 items = [] as any[]
const items = [] as any[]
const defaultItemSize = this.defaultItemSize
const cachedSize = this.cachedSize
const list = this.list
let tempTotalHeight = 0
let tempTotalHeight = 0
let containerTop = 0
let containerTop = 0
let start = false, end = false
for (let i = 0; i < this.list.length; i++) {
for (let i = 0; i < list.length; i++) {
const item = this.list[i]
const item = list[i]
let itemSize = this.defaultItemSize
let itemSize = defaultItemSize
const cachedItemSize = this.cachedSize.get(item)
const cachedItemSize = cachedSize.get(item)
if (cachedItemSize != null) {
if (cachedItemSize != null) {
itemSize = cachedItemSize
itemSize = cachedItemSize
}
}
tempTotalHeight += itemSize
tempTotalHeight += itemSize
if (end) {
if (tempTotalHeight >= this.offsetThreshold[0] && tempTotalHeight <= this.offsetThreshold[3]) {
continue
}
if (tempTotalHeight < offsetStart) {
containerTop = tempTotalHeight
} else if (tempTotalHeight >= offsetStart && tempTotalHeight <= offsetEnd) {
if (start == false) {
start = true
}
items.push(item)
items.push(item)
} else {
} else if (tempTotalHeight < this.offsetThreshold[0]) {
if (!end) {
containerTop = tempTotalHeight
end = true
}
}
}
}
}
this.placeholderHeight = tempTotalHeight
this.placeholderHeight = tempTotalHeight
...
...
雪洛
@u013082782
mentioned in commit
42270934
·
3月 29, 2024
mentioned in commit
42270934
mentioned in commit 422709347fd65293734a88813ee69128c97f3ae6
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录