6.2.0 • Published 15 days ago

virtual-scroll-list-liudingkang v6.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
15 days ago

virtual-scroll-list

Is a virtual-scroll-list developed based on Vue3.

  • 💪 90%+ Unit test coverage
  • 💪 Written in TypeScript
  • 🍭 Support DynamicList and FixedSizeList
  • 🍭 Support Tree Shaking
  • 🍭 Support import on demand
  • 🍭 Support auto-import and provide a solver

Useage

Init

pnpm add virtual-scroll-list-liudingkang
import { createApp } from 'vue'
import App from './App.vue'
import Comps from 'virtual-scroll-list-liudingkang'
import 'virtual-scroll-list-liudingkang/es/style.css'

createApp(App).use(Comps).mount('#app')

Demo

<script setup lang="ts">
  const genText = (base = 15) => {
    const times = base + Math.ceil((Math.random() - 0.5) * base);
    return Array(times)
      .fill(1)
      .map(() => 'every')
      .join(' ');
  };
  const mockData = (num = 20) => {
    let data = [];
    for (let index = 0; index < num; index++) {
      const times = 30 + Math.ceil((Math.random() - 0.5) * 30);
      data.push(genText(times));
    }
    return data;
  };
  const data = mockData(5000);
</script>

<template>
  <LdkDynamicList
    :item-size="70"
    item-class="item"
    :width="300"
    :height="300"
    :data="data"
  >
    <template #default="{ item, index }">
      <div :class="['list-item', index % 2 ? 'list-item-odd' : 'list-item-even']">
        {{ item }}
      </div>
    </template>
  </LdkDynamicList>
</template>

<style scoped>
  .list-item {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .list-item-odd {
    background-color: rgb(229 178 38);
  }

  .list-item-even {
    background-color: cadetblue;
  }
</style>

Attributes

NameDescriptionTypeDefaultOther
itemSize每一项的高度number70单位为px
itemClass每一项的自定义 classstring
itemKey每一项的 keystring\/numberid
data数据any[]
width可视区域宽度number\/string100%
height可视区域高度number\/string300当是 number 时单位为px
cache上下缓冲数量number2单位为px
distance触底加载阈值number0单位为px

Events

NameDescriptionType
load达到加载阈值时触发的事件Function
6.2.0

15 days ago

6.1.7

16 days ago

6.1.4

27 days ago

6.1.6

27 days ago

6.1.5

27 days ago

6.1.3

29 days ago

6.1.2

30 days ago

6.1.0

1 month ago

6.1.1

1 month ago

6.0.3-alpha.2.0

7 months ago

6.0.3-alpha.1.0

7 months ago

6.0.2

7 months ago

6.0.2-alpha.0

7 months ago

6.0.1

8 months ago

6.0.0

8 months ago

5.0.0

8 months ago

4.0.0

8 months ago

3.0.0

8 months ago

2.0.0

8 months ago

1.1.0

8 months ago

1.0.4-alpha.2

8 months ago

1.0.4-alpha.1

8 months ago

1.0.3

8 months ago

1.0.0

9 months ago