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
384 B
23 lines
384 B
6 years ago
|
<script>
|
||
|
import Thing from './Thing.svelte';
|
||
|
|
||
|
let things = [
|
||
|
{ id: 1, value: 'a' },
|
||
|
{ id: 2, value: 'b' },
|
||
|
{ id: 3, value: 'c' },
|
||
|
{ id: 4, value: 'd' },
|
||
|
{ id: 5, value: 'e' }
|
||
|
];
|
||
|
|
||
|
function handleClick() {
|
||
|
things = things.slice(1);
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<button on:click={handleClick}>
|
||
|
Remove first thing
|
||
|
</button>
|
||
|
|
||
|
{#each things as thing}
|
||
|
<Thing value={thing.value}/>
|
||
|
{/each}
|