[Vuejs]-How to select key in Vue multiselect and preselect option? Vue

0👍

Instead of using v-model, use value and @change

:value="form.docTypeIds"

And a @change hander:

@select="handleMultiSelection"

Then add the method that reduces the values into an array of ids:

handleMultiSelection (values) {
  this.form.docTypeIds = values.reduce((carry, obj) => {
    return obj.k
  }, [])
}

Leave a comment