mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
458 B
23 lines
458 B
7 years ago
|
<script>
|
||
6 years ago
|
import Nested from './Nested.svelte';
|
||
7 years ago
|
|
||
6 years ago
|
export let count;
|
||
|
export let idToValue = Object.create(null);
|
||
7 years ago
|
|
||
6 years ago
|
function ids() {
|
||
|
return new Array(count)
|
||
|
.fill(null)
|
||
|
.map((_, i) => ({ id: 'id-' + i}))
|
||
|
.reverse();
|
||
|
}
|
||
7 years ago
|
</script>
|
||
6 years ago
|
|
||
|
<input type='number' bind:value={count}>
|
||
|
|
||
|
<ol>
|
||
|
{#each ids() as object (object.id)}
|
||
|
<Nested bind:value={idToValue[object.id]} id={object.id}>
|
||
|
{object.id}: value is {idToValue[object.id]}
|
||
|
</Nested>
|
||
|
{/each}
|
||
|
</ol>
|