[Vuejs]-Bootstrap Vue – Passing Card Data as a payload

0πŸ‘

It might be Vue reactivity problem. You can use deepCopy (ex: JSON.parse(JSON.stringify()) to make it reactive

setCardToState (state, cardData) {
  state.addeditinitiative.name = cardData.name
  state.addeditinitiative.description = cardData.description
  state.addeditinitiative.id = cardData.id
  state.addeditinitiative = JSON.parse(JSON.stringify(state.addeditinitiative))
}

Btw, you should add :key when using v-for

<b-card v-for="(initiative, index) in initiatives" :key="index" v-b-modal.NewInitiativeModal @click="setCard">
        {{initiative.name}}
</b-card>

Leave a comment