Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Questions about the length prop #254

Answered by rocwang
hunterliu1003 asked this question in Q&A
Discussion options

You must be logged in to vote

Why do we need to pass a length?

The length is required to calculate the total length of grid, under a viewport, so browsers can render the grid with a proper scrollbar, as if all the items are rendered at the same time.

The length also help vue-virtual-scroll-grid to determine which items are visible hence need to be rendered, given a scrollbar position. For example, given a list of 100 item, when you scroll the list half way through, the component may render the 33th to 66th items.

What is the performance benefit of passing a length

length doesn't bring any performance benefits. Instead, it's required for a "virtual scroll" experience.

What is the downside of passing just 99999999 …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hunterliu1003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants