-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial selected object #207
Comments
Were you able to find a solution for this? |
No sorry, and i dont use this component anymore (to outdated) |
I think this would be a good addition. The v-model is only for the query, not the selected item. There was some initial hackery with setChangeItem, but providing a prop or other that can set the initial item would be good. re: "too outdated" comment, I am curious if there is anything you feel is outdated with respect to Vue 2.x? I am currently porting it over to support Vue 3.x here: https://github.com/darrenjennings/vue-autosuggest/tree/next/v3 |
Hello @darrenjennings! I'm using your component and am trying to set a default value from my :suggestions list. |
I found the solution. The component accepts v-model, you can set the default value that way. |
vue-autosuggest
version: 2.2.0hi.
How to preselect an object value?
Using the v-model, is only setting the "userinput", but not the selected-value (and it only accept Strings)
See the forked sandbox where i try to set Gandalf at the inital, selected object, without any user-interaction.
https://codesandbox.io/s/vueautosuggest-20-base-forked-cgy1s?file=/App.vue:2857-3206
This function is relevant for an project where i store the selected object in localstorage, to restore later without bother the user every time.
The text was updated successfully, but these errors were encountered: