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 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}