You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several components provided by `vue-virtual-scroller`:
115
115
116
-
[RecycleScroller](#recyclescroller) is a component that only renders the visible item in your list. It also re-use components and dom elements to be the most efficient and performant possible.
116
+
[RecycleScroller](#recyclescroller) is a component that only renders the visible items in your list. It also re-uses components and dom elements to be as efficient and performant as possible.
117
117
118
-
[DynamicScroller](#dynamicscroller) is a component is using RecycleScroller under-the-hood and adds a dynamic size management feature on top of it. The main use case for this is **not knowing the size of the items** in advance: the Dynamic Scroller will automatically "discover" it when it renders new item as the user scrolls.
118
+
[DynamicScroller](#dynamicscroller) is a component that wraps the RecycleScroller component and extends its features to include dynamic size management. The main use case for this is when you **do not know the size of the items** in advance. The Dynamic Scroller automatically "discovers" item dimensions as it renders new items during scrolling.
119
119
120
120
[DynamicScrollerItem](#dynamicscrolleritem) must wrap each item in a DynamicScroller to handle size computations.
121
121
122
122
[IdState](#idstate) is a mixin that ease the local state management in reused components inside a RecycleScroller.
123
123
124
124
## RecycleScroller
125
125
126
-
It's a virtual scroller which only renders the visible items and reuse all the components and DOM trees as the user scrolls.
126
+
RecycleScroller is a virtual scroller that only renders the visible items. As the user scrolls, RecycleScroller reuses all components and DOM nodes to maintain optimal performance.
127
127
128
128
### Basic usage
129
129
@@ -170,15 +170,15 @@ export default {
170
170
-**⚠️ You need to set the size of the virtual-scroller element and the items elements (for example, with CSS). Unless you are using [variable size mode](#variable-size-mode), all items should have the same height (or width in horizontal mode) to prevent display glitches.**
171
171
-**⚠️ If the items are objects, the scroller needs to be able to identify them. By default it will look for an `id` field on the items. This can be configured with the `keyField` prop if you are using another field name.**
172
172
- It is not recommended to use functional components inside RecycleScroller since the components are reused (so it will actually be slower).
173
-
- The components used in the list should expect `item` prop change without being re-created (use computed props or watchers to properly react to props changes!).
173
+
- The list item components must be reactive to the `item` prop being updated without being re-created (use computed props or watchers to properly react to props changes!).
174
174
- You don't need to set `key` on list content (but you should on all nested `<img>` elements to prevent load glitches).
175
175
- The browsers have a size limitation on DOM elements, it means that currently the virtual scroller can't display more than ~500k items depending on the browser.
176
176
- Since DOM elements are reused for items, it's recommended to define hover styles using the provided `hover` class instead of the `:hover` state selector (e.g. `.vue-recycle-scroller__item-view.hover` or `.hover .some-element-inside-the-item-view`).
177
177
178
178
### How does it work?
179
179
180
180
- The RecycleScroller creates pools of views to render visible items to the user.
181
-
- A view is holding a rendered item, and is reused inside its pool.
181
+
- A view holds a rendered item, and is reused inside its pool.
182
182
- For each type of item, a new pool is created so that the same components (and DOM trees) are reused for the same type.
183
183
- Views can be deactivated if they go off-screen, and can be reused anytime for a newly visible item.
184
184
@@ -212,13 +212,13 @@ When the user scrolls inside RecycleScroller, the views are mostly just moved ar
212
212
213
213
-`items`: list of items you want to display in the scroller.
214
214
-`direction` (default: `'vertical'`): scrolling direction, either `'vertical'` or `'horizontal'`.
215
-
-`itemSize` (default: `null`): display height (or width in horizontal mode) of the items in pixels used to calculate the scroll size and position. If it set to `null` (the default value), it will use [variable size mode](#variable-size-mode).
215
+
-`itemSize` (default: `null`): display height (or width in horizontal mode) of the items in pixels used to calculate the scroll size and position. If it is set to `null` (the default value), it will use [variable size mode](#variable-size-mode).
216
216
-`minItemSize`: minimum size used if the height (or width in horizontal mode) of a item is unknown.
217
217
-`sizeField` (default: `'size'`): field used to get the item's size in variable size mode.
218
-
-`typeField` (default: `'type'`): field used to differenciate different kinds of components in the list. For each distinct type, a pool of recycled items will be created.
219
-
-`keyField` (default: `'id'`): field used to identify items and optimize render views management.
218
+
-`typeField` (default: `'type'`): field used to differentiate different kinds of components in the list. For each distinct type, a pool of recycled items will be created.
219
+
-`keyField` (default: `'id'`): field used to identify items and optimize managing rendered views.
-`prerender` (default: `0`): render a fixed number of items for Server-Side Rendering.
221
+
-`prerender` (default: `0`): render a fixed number of items for Server-Side Rendering (SSR).
222
222
-`buffer` (default: `200`): amount of pixel to add to edges of the scrolling visible area to start rendering items further away.
223
223
-`emitUpdate` (default: `false`): emit a `'update'` event each time the virtual scroller content is updated (can impact performance).
224
224
@@ -233,7 +233,7 @@ When the user scrolls inside RecycleScroller, the views are mostly just moved ar
233
233
234
234
-`item`: item being rendered in a view.
235
235
-`index`: reflects each item's position in the `items` array
236
-
-`active`: is the view active. An active view is considered visible and being positioned by `RecycleScroller`. An inactive view is not considered visible and hidden from the user. Any rendering-related computations should be skipped if the view is inactive.
236
+
-`active`: whether or not the view is active. An active view is considered visible and being positioned by `RecycleScroller`. An inactive view is not considered visible and is hidden from the user. Any rendering-related computations should be skipped if the view is inactive.
237
237
238
238
### Other Slots
239
239
@@ -267,7 +267,7 @@ Example:
267
267
268
268
### Page mode
269
269
270
-
The page mode expand the virtual-scroller and use the page viewport to compute which items are visible. That way, you can use it in a big page with HTML elements before or after (like a header and a footer). Just set the `page-mode`props to `true`:
270
+
The page mode expands the virtual-scroller and uses the page viewport to compute which items are visible. That way, you can use it in a big page with HTML elements before or after (like a header and a footer). Set the `page-mode`prop to `true`:
271
271
272
272
```html
273
273
<header>
@@ -287,7 +287,7 @@ The page mode expand the virtual-scroller and use the page viewport to compute w
287
287
288
288
**⚠️ This mode can be performance heavy with a lot of items. Use with caution.**
289
289
290
-
If the `itemSize` prop is not set or set to `null`, the virtual scroller will switch to Variable size mode. You then need to expose a number field on the item objects with the size of the item element.
290
+
If the `itemSize` prop is not set or is set to `null`, the virtual scroller will switch to variable size mode. You then need to expose a number field on the item objects with the size of the item element.
291
291
292
292
**⚠️ You still need to set the size of the items with CSS correctly (with classes for example).**
293
293
@@ -339,7 +339,7 @@ The `prerender` props can be set as the number of items to render on the server
339
339
340
340
## DynamicScroller
341
341
342
-
This works like RecycleScroller but can render items with unknown sizes!
342
+
This works just like the RecycleScroller, but it can render items with unknown sizes!
343
343
344
344
### Basic usage
345
345
@@ -396,21 +396,21 @@ export default {
396
396
397
397
### Props
398
398
399
-
All the RecycleScroller props.
399
+
Extends all the RecycleScroller props.
400
400
401
401
- It's not recommended to change `sizeField` prop since all the size management is done internally.
402
402
403
403
### Events
404
404
405
-
All the RecycleScroller events.
405
+
Extends all the RecycleScroller events.
406
406
407
407
### Default scoped slot props
408
408
409
-
All the RecycleScroller scoped slot props.
409
+
Extends all the RecycleScroller scoped slot props.
410
410
411
411
### Other slots
412
412
413
-
All the RecycleScroller other slots.
413
+
Extends all the RecycleScroller other slots.
414
414
415
415
## DynamicScrollerItem
416
416
@@ -419,8 +419,8 @@ The component that should wrap all the items in a DynamicScroller.
419
419
### Props
420
420
421
421
-`item` (required): the item rendered in the scroller.
422
-
-`active` (required): is the holding view active in RecleScroller. Will prevent unecessary size recomputation.
423
-
-`sizeDependencies`: values that can affest the size of the item. This prop will be watched and if one value changes, the size will be recomputed. Recommended instead of `watchData`.
422
+
-`active` (required): is the holding view active in RecycleScroller. Will prevent unnecessary size recomputation.
423
+
-`sizeDependencies`: values that can affect the size of the item. This prop will be watched and if one value changes, the size will be recomputed. Recommended instead of `watchData`.
424
424
-`watchData` (default: `false`): deeply watch `item` for changes to re-calculate the size (not recommended, can impact performance).
425
425
-`tag` (default: `'div'`): element used to render the component.
426
426
-`emitResize` (default: `false`): emit the `resize` event each time the size is recomputed (can impact performance).
@@ -431,7 +431,7 @@ The component that should wrap all the items in a DynamicScroller.
431
431
432
432
## IdState
433
433
434
-
This is conveniance mixin that can replace `data` in components being rendered in a RecycleScroller.
434
+
This is convenience mixin that can replace `data` in components being rendered in a RecycleScroller.
0 commit comments