mirror of https://github.com/sveltejs/svelte
parent
2562687ce7
commit
976213d4a1
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
let objArray = [
|
||||||
|
[1, 2, 3, "4"],
|
||||||
|
[5, 6, 7, "8"],
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each objArray as [id, ...rest] (id)}
|
||||||
|
<input bind:value={rest[0]} type="text" placeholder={rest[2]} />
|
||||||
|
<br />
|
||||||
|
{/each}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "invalid-rest-eachblock-binding",
|
||||||
|
"message": "...rest operator will create a new object and binding propogation with original object will not work",
|
||||||
|
"pos": 102,
|
||||||
|
"start": { "line": 8, "column": 24, "character": 102 },
|
||||||
|
"end": { "line": 8, "column": 31, "character": 109 }
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<script>
|
||||||
|
let objArray = [{ bar: {foo: '1', id: 0, innerValue: "test"} }, { bar: {foo: '2', id:1, innerValue: "Somethin"} }]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each objArray as { bar: { id, ...rest } } (id)}
|
||||||
|
<input bind:value={rest.innerValue} type="text" placeholder={rest.foo}/>
|
||||||
|
<br/>
|
||||||
|
{/each}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "invalid-rest-eachblock-binding",
|
||||||
|
"message": "...rest operator will create a new object and binding propogation with original object will not work",
|
||||||
|
"pos": 168,
|
||||||
|
"start": { "line": 5, "column": 32, "character": 168 },
|
||||||
|
"end": { "line": 5, "column": 39, "character": 175 }
|
||||||
|
}
|
||||||
|
]
|
||||||
Loading…
Reference in new issue