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.
22 lines
412 B
22 lines
412 B
6 years ago
|
<script>
|
||
|
import Thing from './Thing.svelte';
|
||
|
|
||
|
let things = [
|
||
3 years ago
|
{ id: 1, name: 'apple' },
|
||
|
{ id: 2, name: 'banana' },
|
||
|
{ id: 3, name: 'carrot' },
|
||
|
{ id: 4, name: 'doughnut' },
|
||
1 year ago
|
{ id: 5, name: 'egg' }
|
||
6 years ago
|
];
|
||
|
|
||
|
function handleClick() {
|
||
|
things = things.slice(1);
|
||
|
}
|
||
|
</script>
|
||
|
|
||
1 year ago
|
<button on:click={handleClick}> Remove first thing </button>
|
||
6 years ago
|
|
||
1 year ago
|
{#each things as thing (thing.id)}
|
||
|
<Thing name={thing.name} />
|
||
4 years ago
|
{/each}
|