mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
384 B
22 lines
384 B
4 years ago
|
<script>
|
||
|
let flavours = [
|
||
|
'Vanilla',
|
||
|
'Strawberry',
|
||
|
'Chocolate',
|
||
|
'Lemon',
|
||
|
'Coconut'
|
||
|
];
|
||
|
|
||
|
let choices = [];
|
||
|
|
||
|
// Put choices first by sorting
|
||
|
$: flavours = flavours.sort((a, b) => choices.includes(b) - choices.includes(a));
|
||
|
</script>
|
||
|
|
||
|
{#each flavours as flavour (flavour)}
|
||
|
<label>
|
||
|
<input type=checkbox bind:group={choices} value={flavour}>
|
||
|
{flavour}
|
||
|
</label>
|
||
|
{/each}
|