Situation:
I have a VueJS2 app with an array of items in my Vuex store:
export default new Vuex.Store({
state: {
checkedItems: []
}
...
The idea is to have the checked (selected) items in a buefy b-table component globally available through this array. The b-table is initiated in my component like so:
<b-table
...
:checked-rows.sync="checkedItems"
...
and the store's state is mapped within the component like so:
...
computed: {
...mapState(['checkedItems'])
},
...
Problem:
The rows get selected visually (i.e. the checkbox toggles between checked/ clear) but the checkedItems array of the store does not get updated. I know this because for debugging I display a count for the array and it remains zero no matter how many items I (de-)select. The browser console shows "[Vue warn]: Computed property "checkedFrqs" was assigned to but it has no setter." when I select a row.
I notice however it works when I manually push an entry in one of the components methods viz:
this.checkedItems.push(row)
Question:
How do I get
:checked-rows.sync="checkedItems"
to work seamlessly for the Vuex array? (P.S. when I use a local array instead of the Vuex store's array, everything also works)