mirror of https://github.com/sveltejs/svelte
fix destructuring to get multiple stores (#5390)
parent
338cf877bc
commit
1ce6ac5d48
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
html: `<h1>2 2 xxx 5 6</h1>`
|
||||||
|
};
|
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
|
let eid = writable(1);
|
||||||
|
let foo;
|
||||||
|
let u;
|
||||||
|
let v;
|
||||||
|
let w;
|
||||||
|
[u, v, w] = [
|
||||||
|
{id: eid = writable(foo = 2), name: 'xxx'},
|
||||||
|
5,
|
||||||
|
writable(6)
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1>{foo} {$eid} {u.name} {v} {$w}</h1>
|
@ -1,6 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
let foo;
|
let foo;
|
||||||
let bar = (foo = 1);
|
let bar = (foo = 1);
|
||||||
|
function a() {
|
||||||
|
bar = (foo = 1);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>{foo} {bar}</h1>
|
<h1>{foo} {bar}</h1>
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
export default {
|
||||||
|
html: `31 42`
|
||||||
|
};
|
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
const context = {
|
||||||
|
store1: writable(31),
|
||||||
|
store2: writable(42)
|
||||||
|
};
|
||||||
|
let store1;
|
||||||
|
let store2;
|
||||||
|
({
|
||||||
|
store1,
|
||||||
|
store2
|
||||||
|
} = context);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{$store1}
|
||||||
|
{$store2}
|
Loading…
Reference in new issue