Skip to content

Commit 0c37d80

Browse files
authored
Update VirtualScroll.svelte - expose "index" to item
Previously you could not do this: ``` <VirtualScroll let:data let:index> ... </VirtualScroll> ``` now you can.
1 parent 39fd58d commit 0c37d80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/VirtualScroll.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,13 @@
269269
</Item>
270270
{/if}
271271
<div style="padding: {paddingStyle}" class="virtual-scroll-wrapper">
272-
{#each displayItems as dataItem (dataItem[key])}
272+
{#each displayItems as dataItem, dataIndex (dataItem[key])}
273273
<Item
274274
on:resize={onItemResized}
275275
uniqueKey={dataItem[key]}
276276
horizontal={isHorizontal}
277277
type="item">
278-
<slot data={dataItem}/>
278+
<slot data={dataItem} index={dataIndex} />
279279
</Item>
280280
{/each}
281281
</div>

0 commit comments

Comments
 (0)