1👍
✅
members
is an array of objects. You need to indicate which element of the array you refer to, like this.members[0].name
or this.members[1].name
, etc.
You should use the optional second argument of v-for
to get the index of the current item and call the addHost()
with this index value, as follows:
<tr v-for="(member, index) in members" :key="member.id">
//.....
<td>
{{member.host}}
<i class="fas fa-plus" @click="addHost(index)"></i>
</td>
Then you change your method to:
addHost(index) {
db.collection("members")
.where("name", "==", this.members[index].name)
.get()
//....
Source:stackexchange.com