Is there a similar way to pass card data like rowData when using bootstrap vue?
I am using this function to commit card data to the state and it doesn't seem to work. I am using a similar method to pass rowData and it works fine.
CARD DATA
Action...
setCard: function ({commit}, cardData) {
commit('setCardToState', cardData)
}
Mutation...
setCardToState (state, cardData) {
state.addeditinitiative.name = cardData.name
state.addeditinitiative.description = cardData.description
state.addeditinitiative.id = cardData.id
},
Template
<b-card v-for="initiative in initiatives" v-b-modal.NewInitiativeModal @click="setCard">
{{initiative.name}}
</b-card>
ROW DATA
Template
<b-table striped
hover
responsive
:items="products"
:fields="fields"
:filter="reportFilter"
:current-page="currentPage"
:per-page="10"
v-b-modal.EditProductModal
@row-clicked="setRow"></b-table>
</b-row>
Action
setRow: function ({commit}, rowData) {
commit('setRowToState', rowData)
},
Mutation
setRowToState (state, rowData) {
state.addeditproduct.name = rowData.name
state.addeditproduct.productline = rowData.productline
state.addeditproduct.description = rowData.description
state.addeditproduct.externalid = rowData.externalid
state.addeditproduct.active = rowData.active
state.addeditproduct.id = rowData.id
},
It might be Vue reactivity problem. You can use deepCopy (ex:
JSON.parse(JSON.stringify())
to make it reactiveBtw, you should add
:key
when usingv-for