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.
29 lines
445 B
29 lines
445 B
6 years ago
|
<script>
|
||
|
import { afterUpdate } from 'svelte';
|
||
|
import flash from './flash.js';
|
||
|
|
||
|
export let todo;
|
||
|
|
||
2 years ago
|
let button;
|
||
6 years ago
|
|
||
|
afterUpdate(() => {
|
||
2 years ago
|
flash(button);
|
||
6 years ago
|
});
|
||
|
</script>
|
||
|
|
||
|
<!-- the text will flash red whenever
|
||
|
the `todo` object changes -->
|
||
2 years ago
|
<button bind:this={button} type="button" on:click>
|
||
1 year ago
|
{todo.done ? '👍' : ''}
|
||
|
{todo.text}
|
||
2 years ago
|
</button>
|
||
3 years ago
|
|
||
|
<style>
|
||
2 years ago
|
button {
|
||
|
all: unset;
|
||
|
display: block;
|
||
3 years ago
|
cursor: pointer;
|
||
|
line-height: 1.5;
|
||
|
}
|
||
2 years ago
|
</style>
|