File tree Expand file tree Collapse file tree 1 file changed +7
-32
lines changed
packages/svelte/tests/runtime-runes/samples/bind-group-nested-data Expand file tree Collapse file tree 1 file changed +7
-32
lines changed Original file line number Diff line number Diff line change 22 import { writable } from ' svelte/store' ;
33
44 let menu = [' Cookies and cream' , ' Mint choc chip' , ' Raspberry ripple' ];
5- let order = writable ({ flavours: [' Mint choc chip' ], scoops: 1 });
5+ let order = writable ({ iceCream: [{flavours: [' Mint choc chip' ]}], scoops: 1 });
6+ let index = 0
67 </script >
78
89<form method =" POST" >
9- <h2 >Size</h2 >
10-
11- <label >
12- <input type ="radio" bind:group ={$order .scoops } name ="scoops" value ={1 } />
13- One scoop
14- </label >
15-
16- <label >
17- <input type ="radio" bind:group ={$order .scoops } name ="scoops" value ={2 } />
18- Two scoops
19- </label >
20-
21- <label >
22- <input type ="radio" bind:group ={$order .scoops } name ="scoops" value ={3 } />
23- Three scoops
24- </label >
25-
26- <h2 >Flavours</h2 >
10+ <input type ="radio" bind:group ={$order .scoops } name ="scoops" value ={1 } /> One scoop
11+ <input type ="radio" bind:group ={$order .scoops } name ="scoops" value ={2 } /> Two scoops
12+ <input type ="radio" bind:group ={$order .scoops } name ="scoops" value ={3 } /> Three scoops
2713
2814 {#each menu as flavour }
29- <label >
30- <input
31- type =" checkbox"
32- bind:group ={$order .flavours }
33- name =" flavours"
34- value ={flavour }
35- />
36- {flavour }
37- </label >
15+ <input type ="checkbox" bind:group ={$order .iceCream [index ].flavours } name ="flavours" value ={flavour } /> {flavour }
3816 {/each }
3917</form >
4018
41- <div >
42- <h2 >Current flavours</h2 >
43- <span id ="output" >{$order .flavours .join (' +' )}</span >
44- </div >
19+ <div id ="output" >{$order .iceCream [index ].flavours .join (' +' )}</div >
You can’t perform that action at this time.
0 commit comments