element
element copied to clipboard
El-autocomplete concatenate with previous field value instead of replacing it
Hello, I use autocomplete element to provide autocomplete in my vue app, let say I use it for autocomplete Authors
I need to fill multiple author with comma as delimiter
first search query is OK
then, I add ", " to it and search for another author
but when I select the author from dropdown, the field is replaced by new value
what I need for final value is "Ressie Bashirian, Dorris Kling"
How to achieve this?
I've tried using this
handleSelect(item) {
console.log(this.model.authors);
if (this.model.authors == null) {
this.model.authors = item.name;
} else {
this.model.authors = `${this.model.authors} ${item.name}`;
}
console.log(this.model.authors);
}
and this is my element
<el-autocomplete
v-else
v-model="model[field.name]"
:hide-loading="true"
:id="field.name"
:fetch-suggestions="authorSearch"
:trigger-on-focus="false"
:placeholder="field.help_text ? field.help_text : field.label"
@keydown="model.response.clearErrors($event.target.name)"
>
but it doesn't work
I am having a similar problem, I added the @input event to do it, although the value of the handleInput method arrives correct it does not change the v-model value.