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
Add index to scoped props available in RecycleList (#54)
* Added the item's index in the list as a scoped property for RecycleList slots
* Adjusted demo page to show usage of the index scoped property
* Added new index scoped prop to readme
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -358,6 +358,7 @@ It's very similar to virtual-scroller, but:
358
358
- Recycles scoped slot content (including components) in the list (no destroyed components), depending on item types (customize with `typeField` prop)
359
359
- 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!)
360
360
- You don't need to set `key` on list content (but you should on `<img>` elements)
361
+
- To emulate conditions that would otherwise be available in a `v-for` loop, the scoped slot exposes an `index` prop that reflects each item's position in the `items` array
361
362
362
363
Both fixed and dynamic height modes are supported (set `itemHeight` prop for fixed height mode).
363
364
@@ -367,7 +368,7 @@ Both fixed and dynamic height modes are supported (set `itemHeight` prop for fix
367
368
:items="items"
368
369
>
369
370
<!-- For each item -->
370
-
<templateslot-scope="{ item }">
371
+
<templateslot-scope="{ item, index }">
371
372
<!-- Reactive dynamic height -->
372
373
<div
373
374
v-if="item.type === 'letter'"
@@ -381,6 +382,7 @@ Both fixed and dynamic height modes are supported (set `itemHeight` prop for fix
0 commit comments