更新记录

1.0.0(2025-07-01) 下载此版本

发布


平台兼容性

uni-app(4.24)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - -

其他

多语言 暗黑模式 宽屏模式
× ×

虚拟列表-解决大数据列表性能问题

组件名 VirtualList

使用方式

引入直接使用,插槽传出每一项的item,index宽度是100%,高度是根据外部盒子自适应,需要传入每一项的高度,如果项目使用了postcss vw格式 则需要将postCssWidth属性传入postcss设置的宽度,不传按照px计算渲染。

<template>
  <view
    style="height: calc(100vh - 200px); width: 100vw; background-color: red"
  >
    <h1 @click="handleClick">asdasd</h1>
    <easy-use-virtualList
      :items="items"
      :itemHeight="90"
      :postCssWidth="1024"
      ref="virtualList"
    >
      <template #default="{ item, index }">
        <view class="list-item">
          <text>{{ item }}</text>
        </view>
      </template>
    </easy-use-virtualList>
  </view>
</template>

<script>
export default {
  data() {
    return {
      items: [],
    };
  },
  mounted() {
    setTimeout(() => {
      this.items = Array.from({ length: 1000 }, (_, i) => `Item ${i + 1}`);
    }, 1000);
  },
  methods: {
    handleClick() {
      this.$refs.virtualList.scrollToTop();
    },
  },
};
</script>

<style scoped>
.list-item {
  padding: 10px;
  background-color: #f0f0f0;
  border-bottom: 1px solid #ddd;
}
</style>

api

属性名 说明
items 列表数据
itemHeight item高度
postCssWidth postcss设置的宽度如1024,不设置该属性则按照px格式渲染和计算

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问