ElemeFE / ElemeFE/element

El-autocomplete concatenate with previous field value instead of replacing it

Open
#21,913 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

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
![image](https://user-images.githubusercontent.com/36181208/172544622-b974eafe-e160-4296-a1ef-346a2d8ebf2e.png)
then, I add ", " to it and search for another author
![image](https://user-images.githubusercontent.com/36181208/172544727-b3ed8386-dcf5-4958-b58c-73e74f73e768.png)
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
```

```
but it doesn't work

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.