tangbc / vue-virtual-scroll-list

⚡️A vue component support big amount data list with high render performance and efficient.
https://tangbc.github.io/vue-virtual-scroll-list
MIT License
4.42k stars 592 forks source link

Start variable sets incorrect padding near list end #37

Closed alden-ozburn closed 6 years ago

alden-ozburn commented 6 years ago

Reproduction

From the first example: https://tangbc.github.io/vue-virtual-scroll-list/examples/finite/

Entering a start index >= 99950 scrolls to the bottom.

This is despite the fact that there is more room to scroll down up within the window.

alden-ozburn commented 6 years ago

It seems to be based on the keeps variable, in turn based on the remain and bench variables. It looks like the calculation that relies on them to find whether it is the last index does not take into account the view window perhaps?

Great work so far by the way, this is definitely the most thorough virtual scroller for vue.

alden-ozburn commented 6 years ago

For anyone else running into this issue, a quick hack to bypass this issue is to pad the list with 0 height dummy element, using variable height mode.

tangbc commented 6 years ago

Reason is: start and end calculate right but offset wrong if start more than remains.

Change commit here: https://github.com/tangbc/vue-virtual-scroll-list/commit/d587f682432574c6cb1df54e2db372befc28c905