Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tested the example in sveltejs/svelte#2308 (comment), it works
- Loading branch information
iacore
committed
Apr 20, 2024
1 parent
a2debfa
commit 72f33ea
Showing
3 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
<script> | ||
let name = ['existing option']; | ||
</script> | ||
|
||
<h1>Refresh to reset</h1> | ||
<h1>{JSON.stringify(name)}</h1> | ||
Try click on these: | ||
<input type="checkbox" value="no" bind:group={name}> | ||
<input type="checkbox" value="yes" bind:group={name}> | ||
{#each menu as flavour} | ||
<Flavour {flavour}/> | ||
{/each} | ||
|
||
<script> | ||
import Flavour from "./Flavour.svelte" | ||
let menu = [ | ||
'Cookies and cream', | ||
'Mint choc chip', | ||
'Raspberry ripple' | ||
]; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<label> | ||
<input type=checkbox bind:group={$flavours} value={flavour}> | ||
{flavour} | ||
</label> | ||
<script> | ||
import { flavours } from "./stores.js" | ||
export let flavour | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { writable } from 'svelte/store'; | ||
|
||
export const flavours = writable([]); | ||
|
||
flavours.subscribe(console.log) |