vue-multiselect icon indicating copy to clipboard operation
vue-multiselect copied to clipboard

Default select value

Open robertowiest opened this issue 3 years ago • 3 comments

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?

robertowiest avatar Oct 04 '21 10:10 robertowiest

you have the preselectFirst prop or set your v-model to the value you want.

akorajac avatar Oct 05 '21 03:10 akorajac

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'}.

WhereJuly avatar Nov 19 '21 06:11 WhereJuly

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.

lehoaibaokg avatar Mar 04 '22 15:03 lehoaibaokg

As previously mentioned, setting the value of the v-model is a great way to automatically select a value in the multiselect.

mattelen avatar Aug 26 '22 16:08 mattelen