<ul>
{#each items as item}
<li>{item.name} x {item.qty}</li>
{:else}
<li>Empty list</li>
{/each}
</ul>
//INDEX
{#each items as item, index}
<li>
{index + 1}: {item.name} x {item.qty}
</li>
{/each}
//INDEX (KEY)
{#each items as item, index (item.id)}
<li>
{index + 1}: {item.name} x {item.qty}
</li>
{/each}
Comments
Related