using a v-dialog in a v-for loop overwrites click event for all but last v-dialog when using vuetify

I have an app that is using a Vuetify v-dialog in a v-for loop. However, although the separate activator components render correctly within each v-dialog, when I click on one of the chips it emits the click event for the last v-chip regardless of what chip i click on..

It is as though all the v-dialogs are using the same click event to submit the data from the last v-chip.

Why is the corresponding click event for each v-dialog not being invoked when a chip is clicked?

Demo: https://codepen.io/deftonez4me/pen/ExyQRxB

Upvotes: 1

Views: 1667

Answers (1)

tao
tao

Reputation: 90038

Just use an object instead of an array and replace removeTagDialogs[removeTagDialogs.indexOf(tag.id)] with removeTagDialogs[tag.id], in both places.

See it working: https://codepen.io/andrei-gheorghiu/pen/WNxMyMa

Upvotes: 2

Related Questions