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.
svelte/documentation/tutorial/16-special-elements/09-svelte-options/app-a/Todo.svelte

29 lines
445 B

<script>
import { afterUpdate } from 'svelte';
import flash from './flash.js';
export let todo;
let button;
afterUpdate(() => {
flash(button);
});
</script>
<!-- the text will flash red whenever
the `todo` object changes -->
<button bind:this={button} type="button" on:click>
{todo.done ? '👍' : ''}
{todo.text}
</button>
<style>
button {
all: unset;
display: block;
cursor: pointer;
line-height: 1.5;
}
</style>