vue-multiselect
vue-multiselect copied to clipboard
Default select value
Hi, I have two selects that get data from the database. Data is loaded and displayed correctly. However, I would like that when getting this data from the database, a specific information is automatically selected when loading the multi-select. How can I do this?
you have the preselectFirst
prop or set your v-model to the value you want.
If you use this multiselect with objects, then v-model
value has to be of the same object format, that is used for options
props, e.g. {id: 123, title: 'title here'}
.
You can use v-model to set the default selection you want. Or if you want to handle the input and output data, you should wrap the vue-multiselect into a component.
As previously mentioned, setting the value of the v-model is a great way to automatically select a value in the multiselect.