Skip to content

VirtList API

Attributes

AttributeDescriptionTypeDefaultRequired
listlist dataArray-
itemKeyThe Id of Item,(if not, scroll fail)String|Number-
minSizeThe Min Size of ItemNumber20
itemGapthe gap between item (item size include itemGap)Number0-
fixedfixed height of item use itNumberfalse-
bufferWhen the rendering amount is large and the scrolling white screen is serious, you can give a value
bufferTop = bufferBottom = buffer
Number0-
bufferTopbuffer of topNumber0-
bufferBottombuffer of bottomNumber0-
horizontalis horizontal scrollingBooleanfalse-
fixSelectionfix the scrolling loss selection problem (only required and effective in vue2 diff-bug)Booleanfalse-
startStart rendering indexNumber0-
offsetStart rendering scrollTopNumber0-
listStylelist container styleString''-
listClasslist container classString''-
itemStyleitem styleString''-
itemClassitem classString''-
renderControlrender control(begin: number, end: number ) => { begin: number; end: number };--

Slots

NameDescription
headerthe slot of header
footerthe slot of footer
sticky-headerthe slot of sticky header
sticky-footerthe slot of sticky footer
emptythe slot of empty
defaultthe slot of item, slotScoped = { itemData, index }

Events

Event NameDescriptionParameters
toTopthe event of arrived topthe itemData of first
toBottomthe event of arrived bottomthe itemData of last
scrollthe event of scrollingevent
itemResizethe event of item size has changed{ id: string, newSize: number }
rangeUpdatethe event of startIndex or endIndex in view has changed{ inViewBegin: number, inViewEnd: number }

Methods

MethodDescriptionParameters
resetreset VirtList-
getOffsetget scrollTop(or scrollLeft)-
scrollToTopscroll to top-
scrollToBottomscroll to bottom-
scrollToIndexscroll to indexindex
scrollInToViewscroll to index if needed(if item is not in view)index
scrollToOffsetscroll to pxpx
getItemSizeget size of itemindex
getItemPosByIndexget position of item: { top: number; current: number; bottom: number;}index
forceUpdateforce update(render)-
deletedList2Topdeleted list of top part(Learn more in pagination example)list[]
addedList2Topadded list of top part(Learn more in pagination example)list[]
manualRendermanual render(need support renderBegin  & renderEnd)(renderBegin: number, renderEnd: number) => void
getReactiveDatareturn reactive datareactiveData:ReactiveData

reactive:ReactiveData

AttributeTypeDescription
viewsnumberrendered number In view
offsetnumberscrollTop or scrollLeft
listTotalSizenumberthe total of list size(Height without slots)
virtualSizenumberThe virtual placeholder size is the size from 0 to renderBegin
inViewBeginnumberThe start Index in view
inViewEndnumberThe end Index in view
renderBeginnumberThe start Index of rendered
renderEndnumberThe end Index of rendered
bufferTopnumberThe buffer of top
bufferBottomnumberThe buffer of bottom

slotSize:SlotSize

AttributeTypeDescription
clientSizenumberthe client size
headerSizenumberheader slot size
footerSizenumberfooter slot size
stickyHeaderSizenumberstickyHeader slot size
stickyFooterSizenumberstickyFooter slot size