I have a list of clients, which is actually an array of objects. I store it in Vuex. I present a list in my component and each line has a checkbox. More precisely, I'm using keen-ui, and the checkbox rendering part looks like this:
<tr v-for="customer in customers" :class="{ selected: customer.selected }">
<td>
<ui-checkbox :value.sync="customer.selected"></ui-checkbox>
</td>
<td>{{ customer.name }}</td>
<td>{{ customer.email }}</td>
</tr>
Thus, the checkbox directly changes the array of clients, which is bad: I use strict mode in Vuex, and this causes an error.
I want to track when an array is changed, and call an action to change the state of vuex:
watch: {
'customers': {
handler() {
},
deep: true
}
However, he is still directly changing the client. How can i fix this?
source
share