Open gponty opened 7 months ago
Hi :)
<script> import AutoComplete from "simple-svelte-autocomplete" let selectedColor; async function searchColor(keyword) { return [ { id:1,color:"White" }, { id:2,color:"Black" }, ] } </script> <AutoComplete searchFunction={searchColor} bind:selectedItem={selectedColor} labelFieldName="color" valueFieldName="id" onChange="{() => console.log(selectedColor)}" />
selectedColor = { id:1,color:"White" } instead of selectedColor = 1
REPL : https://svelte.dev/repl/b6a3421f9a574c148ba740d88e75ab81?version=4.2.9
Thank you
Yes this is wrong in the readme I think, you should do bind:value={selectedColor} instead.
bind:value={selectedColor}
This example in the read me makes it look like you can use valueFieldName with selectedItem
valueFieldName
selectedItem
Thank you @Astronautilus14
Hi :)
selectedColor = { id:1,color:"White" } instead of selectedColor = 1
REPL : https://svelte.dev/repl/b6a3421f9a574c148ba740d88e75ab81?version=4.2.9
Thank you