I have a v-autocomplete that loops a list of users. I then add them to a new list via a btn. How to I stop and alert that a user has already been added by comparing the dup key?
<v-autocomplete
v-model="event.user"
:items="usersData"
label="Seach speaker list"
:search-input.sync="searchUser"
return-object
item-value="id"
item-text="name"
></v-autocomplete>
My method to addSpeaker is:
addSpeaker() {
const newSpeaker = {
id: this.event.user.uid,
name: this.event.user.name,
}
this.speakers.push(newSpeaker)
this.event.user = ''
},
removeSpeaker(id) {
this.speakers = this.speakers.filter(speaker => speaker.id !== id)
}
Is there a check I can do here to prevent a user being added if it already has been?