adjustments

pull/2677/head
Conduitry 6 years ago
parent 369b087d09
commit 82c2688d03

@ -47,7 +47,7 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
// Values that are passed in as props
// are immediately available
console.log(foo, bar);
// Function expressions can also be props
export let format = (number) => (number.toFixed(2));

@ -188,18 +188,19 @@ If a *key* expression is provided — which must uniquely identify each list ite
---
You can freely use the destructuring pattern in each blocks, the rest syntax being supported.
You can freely use destructuring and rest patterns in each blocks.
```sv
{#each items as {id, name, qty}, i (id)}
```html
{#each items as { id, name, qty }, i (id)}
<li>{i + 1}: {name} x {qty}</li>
{/each}
{#each objects as {id, ...rest}}
<li><span>{id}</span><MyComponent {...rest} /></li>
{#each objects as { id, ...rest }}
<li><span>{id}</span><MyComponent {...rest}/></li>
{/each}
{#each items as [id, ...rest]}
<li><span>{id}</span><MyComponent values={rest} /></li>
<li><span>{id}</span><MyComponent values={rest}/></li>
{/each}
```
@ -1358,4 +1359,4 @@ The `<svelte:options>` element provides a place to specify per-component compile
```html
<svelte:options tag="my-custom-element"/>
```
```
Loading…
Cancel
Save