mirror of https://github.com/sveltejs/svelte
parent
8a2e94163d
commit
5f8988ad73
@ -1,20 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
let works1 = $state([{ text: 'foo' }]);
|
let a = $state([{ text: 'foo' }]);
|
||||||
|
|
||||||
|
let b = $state([{ text: 'foo' }]);
|
||||||
|
|
||||||
let text = $state('foo');
|
let text = $state('foo');
|
||||||
let works2 = $state([{ get text() { return text }, set text(v) { text = v }}]);
|
let c = $state([{ get text() { return text.toUpperCase() }, set text(v) { text = v }}]);
|
||||||
|
|
||||||
let doesntwork = $state([{ text: 'foo' }]);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each works1 as item, i}
|
{#each a as item, i}
|
||||||
<button on:click={() => works1[i].text = 'bar'}>{item.text}</button>
|
<button on:click={() => a[i].text = 'bar'}>{item.text}</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#each works2 as item}
|
{#each b as item}
|
||||||
<button on:click={() => item.text = 'bar'}>{item.text}</button>
|
<button on:click={() => item.text = 'bar'}>{item.text}</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#each doesntwork as item}
|
{#each c as item}
|
||||||
<button on:click={() => item.text = 'bar'}>{item.text}</button>
|
<button on:click={() => item.text = 'bar'}>{item.text}</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
Loading…
Reference in new issue