From 93ff688b8e70862c55797dbdb7553eea55d81f8e Mon Sep 17 00:00:00 2001 From: Fabio Traverso Date: Wed, 1 Mar 2023 12:44:33 -0300 Subject: [PATCH 1/2] exposed index --- VirtualList.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VirtualList.svelte b/VirtualList.svelte index adbc2f2..f488cd0 100644 --- a/VirtualList.svelte +++ b/VirtualList.svelte @@ -161,7 +161,7 @@ > {#each visible as row (row.index)} - Missing template + Missing template {/each} From 1f7bd62633b7261c3d63218f734fb765b2808ec9 Mon Sep 17 00:00:00 2001 From: Fabio Traverso Date: Wed, 1 Mar 2023 12:56:29 -0300 Subject: [PATCH 2/2] update readme to include index --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index f12c758..ae0c814 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,16 @@ You can optimize initial display and scrolling when the height of items is known ``` +## `index` + +You can access the index of each item in the virtual list by using the `index` attribute: + +```html + +

{index}: {item.number} - {item.name}

+
+``` + ## Configuring webpack