vue3虚拟滚动列表vue3scroll-list

虚拟滚动列表

vue3-virtual-scroll-list

https://github.com/reactjser/vue3-virtual-scroll-list

https://vue3-virtual-scroll-list-examples-xi.vercel.app/#/

⚡️ A vue3 component support big amount data list with high scroll performance.

支持动态高度,无限加载

Basic Useage

npm install vue3-virtual-scroll-list



Props

必选 props

参数

说明

类型

默认值

data-key

The unique key get from data-sources in each data object. Or a function called with each data-source and return their unique key. Its value must be unique in data-sources, it is used for identifying item size.

string | () => string

-

data-sources

The source array built for list, each array data must be an object and has an unique key get or generate for data-key property.

object[]

-

data-component

The render item component created / declared by vue, and it will use the data object in data-sources as render prop and named: source.

Component

-

可选 props

参数

说明

类型

默认值

keeps

How many items you are expecting the virtual list to keep rendering in the real dom

number

30

extra-props

Extra props assign to item component that are not in data-sources. Notice: index and source are both occupied inner

Object

{}

estimate-size

The estimate size of each item, if it is closer to the average size, the scrollbar length looks more accurately. It is recommended to assign the average that calculate by yourself

number

50

Public Methods

方法名

说明

回调参数

reset

Reset all state back to initial

-

scrollToBottom

Manual set scroll position to bottom

-

scrollToIndex

Manual set scroll position to a designated index

index: number

scrollToOffset

Manual set scroll position to a designated offset

offset: number

getSize

Get the designated item size by id (from data-key value)

id: string

getSizes

Get the total number of stored (rendered) items

-

getOffset

Get current scroll offset.

-

getClientSize

Get wrapper element client viewport size (width or height)

-

getScrollSize

Get all scroll size (scrollHeight or scrollWidth)

-

updatePageModeFront

When using page mode and virtual list root element offsetTop or offsetLeft change, you need call this method manually

-

Slots

名称

说明

header

header slot

footer

footer slot

展开阅读全文

页面更新:2024-05-14

标签:法名   列表   加载   高度   名称   参数   类型   动态

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top