am new to vue, while building an update form, I had an issue pre-selecting multiple option when multiple selected
attribute is specified only the last one get selected and I also discovered the selected
attribute is never rendered by vue!
I found a vue package that supports this vue-multiselect
But I just want to know why vue doesn’t support this and I have to use another library?
Vue is a declarative Model-View rendering framework, not a component library. All Vue does is rendering HTML. In this sense "Vue can do" whatever HTML can do....
HTML <select>
element allows to use multiple
attribute and Vue supports it with it's v-model
directive but you must bind to an array
Why v-model
ignores selected
attribute ?
v-model
will ignore the initialvalue
,checked
, orselected
attributes found on any form elements. It will always treat the Vue instance data as the source of truth. You should declare the initial value on the JavaScript side, inside the data option of your component.