mirror of https://github.com/sveltejs/svelte
14 lines
321 B
14 lines
321 B
<script>
|
|
export let items;
|
|
export let numCompleted;
|
|
|
|
$: numCompleted = items.reduce((total, item) => {
|
|
return total + (item.completed ? 1 : 0);
|
|
}, 0);
|
|
</script>
|
|
|
|
{#each items as item}
|
|
<div><input type='checkbox' bind:checked={item.completed}><p>{item.description}</p></div>
|
|
{/each}
|
|
|
|
<p>{numCompleted} completed</p> |