1.0.1 • Published 3 years ago

virtual-list-scroll-v3 v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Demo

Install

npm i virtual-list-scroll

Import

import Vue from "vue"
import VirtualListScroll from "virtual-list-scroll-v3"
// 在components里面注册组件即可

Usage

Page Mode

<VirtualListScroll :data="blocks">
    <template v-slot:default="item">
        <div :style="{ height: '100%', 'background-color': item.color }">
          {{ item.id }}
        </div>
      </template>
</VirtualListScroll>

Container Mode

<VirtualListScroll :height="300" :pageMode="false" :data="blocks">
    <template v-slot:default="item">
        <div :style="{ height: '100%', 'background-color': item.color }">
          {{ item.id }}
        </div>
      </template>
</VirtualListScroll>

Flxed Block Height

<VirtualListScroll
  :height="300"
  :pageMode="false"
  :flxedBlockHeight="50"
  :data="blocks"
>
<template v-slot:default="item">
        <div :style="{ height: '100%', 'background-color': item.color }">
          {{ item.id }}
        </div>
      </template>
</VirtualListScroll>

Unique virtual block

<VirtualListScroll :height="300" :pageMode="false" :data="blocks">
    <template v-bind:default="item">
    <template v-if="item.id===0"></template>
    <template v-if="item.id===1"></template>
    </template>
</VirtualListScroll>

Props

NameTypeDefaultDescription
dataArray-必填项,列表中数组数据
heightNumber-虚拟滚动区域的高度
flxedBlockHeightNumber-每一个列表 Item 的高度
pageModeBooleantrue假定滚动条是在 window 上还是在指定的虚拟滚动盒子上

DataObjet

NameTypeDefaultDescription
idString/Number-必填项,虚拟列表渲染的唯一 key
heightNumber-只有当flxedBlockHeight没有设定的时候才会使用这个值

License

MIT

1.0.1

3 years ago

1.0.0

3 years ago