make each block binding example clearer

pull/2421/head
Richard Harris 7 years ago
parent db57b2c110
commit fa2eceeee2

@ -12,12 +12,20 @@
function clear() { function clear() {
todos = todos.filter(t => !t.done); todos = todos.filter(t => !t.done);
} }
$: remaining = todos.filter(t => !t.done).length;
</script> </script>
<style>
.done {
opacity: 0.4;
}
</style>
<h1>Todos</h1> <h1>Todos</h1>
{#each todos as todo} {#each todos as todo}
<div> <div class:done={todo.done}>
<input <input
type=checkbox type=checkbox
bind:checked={todo.done} bind:checked={todo.done}
@ -30,6 +38,8 @@
</div> </div>
{/each} {/each}
<p>{remaining} remaining</p>
<button on:click={add}> <button on:click={add}>
Add new Add new
</button> </button>

@ -12,12 +12,20 @@
function clear() { function clear() {
todos = todos.filter(t => !t.done); todos = todos.filter(t => !t.done);
} }
$: remaining = todos.filter(t => !t.done).length;
</script> </script>
<style>
.done {
opacity: 0.4;
}
</style>
<h1>Todos</h1> <h1>Todos</h1>
{#each todos as todo} {#each todos as todo}
<div> <div class:done={todo.done}>
<input <input
type=checkbox type=checkbox
checked={todo.done} checked={todo.done}
@ -30,6 +38,8 @@
</div> </div>
{/each} {/each}
<p>{remaining} remaining</p>
<button on:click={add}> <button on:click={add}>
Add new Add new
</button> </button>

@ -12,12 +12,20 @@
function clear() { function clear() {
todos = todos.filter(t => !t.done); todos = todos.filter(t => !t.done);
} }
$: remaining = todos.filter(t => !t.done).length;
</script> </script>
<style>
.done {
opacity: 0.4;
}
</style>
<h1>Todos</h1> <h1>Todos</h1>
{#each todos as todo} {#each todos as todo}
<div> <div class:done={todo.done}>
<input <input
type=checkbox type=checkbox
bind:checked={todo.done} bind:checked={todo.done}
@ -30,6 +38,8 @@
</div> </div>
{/each} {/each}
<p>{remaining} remaining</p>
<button on:click={add}> <button on:click={add}>
Add new Add new
</button> </button>

Loading…
Cancel
Save