May I ask the reason that arrays of primitive values are converted to arrays of { value:value label:value }? From the simple example:
<script>
import Select from 'svelte-select';
let items = ['One', 'Two', 'Three'];
let value = null;
</script>
<Select {items} bind:value />
{#if value}
Selected value: {value.label}
{/if}
It would be simpler if I could do:
Selected value: {value}
My actual use case is binding the value of Select to an array property of an object:
<script>
import Select from 'svelte-select';
let items = ['One', 'Two', 'Three'];
const myData = {
arr: ['One', 'Three']
};
</script>
<Select {items} bind:value={myData.arr}/>
Selected value: {myData.arr.join('|')}
May I ask the reason that arrays of primitive values are converted to arrays of { value:value label:value }? From the simple example:
<script> import Select from 'svelte-select'; let items = ['One', 'Two', 'Three']; let value = null; </script><Select {items} bind:value />
{#if value}
Selected value: {value.label}
{/if}It would be simpler if I could do:
Selected value: {value}
My actual use case is binding the value of Select to an array property of an object:
<script> import Select from 'svelte-select'; let items = ['One', 'Two', 'Three']; const myData = { arr: ['One', 'Three'] }; </script><Select {items} bind:value={myData.arr}/>
Selected value: {myData.arr.join('|')}