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.
27 lines
396 B
27 lines
396 B
6 years ago
|
<script>
|
||
|
import { afterUpdate } from 'svelte';
|
||
|
import flash from './flash.js';
|
||
|
|
||
|
export let todo;
|
||
6 years ago
|
export let toggle;
|
||
6 years ago
|
|
||
6 years ago
|
let div;
|
||
|
|
||
|
afterUpdate(() => {
|
||
|
flash(div);
|
||
|
});
|
||
6 years ago
|
</script>
|
||
|
|
||
6 years ago
|
<style>
|
||
|
div {
|
||
|
cursor: pointer;
|
||
|
line-height: 1.5;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
6 years ago
|
<!-- the text will flash red whenever
|
||
6 years ago
|
the `todo` object changes -->
|
||
|
<div bind:this={div} on:click>
|
||
|
{todo.done ? '👍': ''} {todo.text}
|
||
|
</div>
|