vue-list-scroller
It can help with creating Twitter-like feed with thousands of items. It renders only visible part of the list.
Notes
- Only page mode. It does not work inside an overflow container
- Uses ResizeObserver
- Items can have any size and change dynamically
- Items can have margins
- Supports infinite scroll
Usage
Add package to your project
Create item component
Add ListScroller component to your project
Example
You can clone this project and start example locally with these commands. It's in the dev folder.
Props
itemsData
: array of the data that is passed to itemsitemHeight
: approximate item height in pixels. it's used only at first renderingitemComponent
: vue js item componentrenderViewports
: height of the rendered part relative to viewport height. For example, if it's set to 5 and window inner height is 400, it will render 800 pixels before and after visible part of the list
Events
bottom
: emits when the last item is rendered. Used for infinite scroll