Skip to content

useVirtualList ​

A hook that allows you to use virtual list to render huge chunks of list data.

Code demonstration ​

Default usage ​

Dynamic item height ​

API ​

ts
import { useVirtualList } from 'vue-hooks-plus'

Params ​

PropertyDescriptionTypeDefault
listThe original list that contains a lot of data entriesRef<T[]>[]
optionsconfigOptions-

Options ​

PropertyDescriptionTypeDefault
wrapperTargetnner Container,DOM element or refRef<TargetValue<HTMLElement>>-
itemHeightItem height, accept a pixel value or a function that returns the height`number((index: number, data: T) => number)`
overscanThe extra buffer items outside of the view areanumber5

Result ​

参数说明类型默认值
listThe current portion of data need to be rendered to DOMRef<{ data: T, index: number }[]>-
refOutter Container,support DOM element or refRef<TargetValue<HTMLElement>>-
onScrollScroll to specific index(e: any) => void-

Source ​

Source · Document · Demo

Released under the MIT License.