更新记录
1.0.4.2(2025-05-30)
下载此版本
优化虚拟列表
1.0.4.1(2025-05-29)
下载此版本
优化变量
1.0.4(2025-05-29)
下载此版本
优化重复加载
查看更多
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
√ |
√ |
√ |
- |
- |
- |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
iasei-scroll
组件介绍
本组件是大量数据列表渲染优化组件
属性说明
名称 |
类型 |
默认值 |
描述 |
data |
Array |
[] |
数据列表 |
mode |
String |
list |
值有:list、page、virtual。(list) 正常显示所有data数据; (page) 分页优化。初次加载数据必须是全部数据;(virtual) 虚拟列表。只加载可视区域的数据,data中的每条数据必须$height字段(单位为px,可以用uni.rpx2px()转换)。$height必须包含padding和margin; |
refresher |
Boolean |
false |
是否下拉刷新 |
pageSize |
Number |
20 |
分页数量。 mode==list时 无效;mode==page时 是分页数量;mode==virtual时 是优化虚拟数据第一条查询速度,一般设置为显示区域显示数据的条数 |
事件
名称 |
类型 |
说明 |
@next |
function |
下一页回调 , mode=='list'有效 |
@refresh |
function(setLoading:Function) |
下拉刷新回调,setLoading(true) 显示loading,setLoading:(false) 关闭loading |
方法
名称 |
类型 |
说明 |
setScrollTop(y:Number) |
function |
设置滚动条位置, y 距离顶部绝对位置,单位px |
setList(data:Array) |
function |
设置渲染数据, 在渲染数据时间明显变长的情况下可以使用该方法 |
插槽
属性名 |
属性值 |
用法 |
说明 |
#default |
具名插槽 |
<template #default="{item,index}" > |
item:数据对象;index:数据索引 |
#tip |
具名插槽 |
<template #tip> |
有数据底部提示插槽 |
#nodata |
具名插槽 |
<template #nodata> |
无数据提示插槽 |
使用方式
<template>
<iasei-scroll ref="scroll" refresher mode="virtual">
<template #default="{item,index}">
<view class="item" :style="{height:item.$height + 'px',background:index % 2 ? 'burlywood' : 'bisque'}">
<span>我是第{{index}}条数据</span>
</view>
</template>
</iasei-scroll>
</template>
<script>
export default {
components: {},
data() {
return {
allList: [],
}
},
onLoad() {
this.handleNext()
this.$nextTick(()=>{
this.$refs.scroll.setList(this.allList)
})
},
onShow() {
},
computed: {
},
methods: {
handleNext() {
console.log(new Date().getTime())
let top = 0
for (let i = 0; i < 5 * 1000; i++) {
const type = i % 3 ? 1 : 0
const h = type ? 50 : 100
this.allList.push({
'index': i,
'type': type,
'$height': h,
})
top = top + h
}
console.log(new Date().getTime())
}
}
}
</script>
<style>
page {
height: 100%;
}
.item {
/* 按照实际需求写css */
width: 100%;
}
</style>