vue-multiselect
vue-multiselect copied to clipboard
after select return value from array of object.
it always return an array. How do I return just a value from the array of object. [ {id:1, title: "text1"}, {id:2, title: "text2"} ]
label is title, but I want it to only return the id value.
thank you
+1
+1
as it seems multiselect doesn't support that. There is another long issue about it. I've just changed to vue-select last week because of that. Since a lot of parameters are called the same you can almost use it as drop in replacement.
is there some progress?
I have been using: https://github.com/sagalbot/vue-select hope it helps
You can use @input="(e)=>{yourMethod(e)}"
Then you can create the method, ie:
yourMethod(e) {
if(this.suppliers.includes(e[0].id)){
this.suppliers=_.without(this.suppliers,e[0].id)
}else{
this.suppliers.push(e[0].id)
}
},
(in my example I'm populating an array called 'suppliers' with the ID of the returned value) - worked in my tests
Duplicate of https://github.com/shentao/vue-multiselect/issues/1270