[Vuejs]-Pass row.item.attribute value to a modal with Bootstrap Vuejs

0👍

The problem here is that there is a loop in this component going through every row, rendering a new b-modal for each row. The problem is in this part of the code:

```
<b-form-select
      v-model="userdata.eventApiId"
      class="mb-3">
```

Each time a modal is rendered for a new row, it changes the userdata.eventApiId to the value for the current row. So the userdata.eventApiId will always end up being the api_id for the last row of the table.

One solution would be to change the code so that when the button is clicked, you change the userdata.eventApiId to the row.item.api_id.

I also wouldn’t recommend putting the modal in the loop, as you would be creating a lot of hidden modals. I would just have one modal outside of the table that changes the value of userdata.

Leave a comment