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.
21 lines
352 B
21 lines
352 B
5 years ago
|
<script>
|
||
|
import {writable} from 'svelte/store';
|
||
|
|
||
|
function action(node, binding) {
|
||
|
return {
|
||
|
update: (value) => s.set(value),
|
||
|
}
|
||
|
}
|
||
|
let s = writable("simple");
|
||
|
let v = "";
|
||
|
|
||
|
function click() {
|
||
|
s.set('clicked');
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<input bind:value={v} use:action={v}>
|
||
|
<div>{v}</div>
|
||
|
<div>{$s}</div>
|
||
|
<button on:click={click}>click me</button>
|