Answer the question
In order to leave comments, you need to log in
How to avoid props mutation?
An array of instances of some class items[] lies in vuex, is used in many places and at the same time is displayed in an editable list:
<ul>
<v-list-component :item=item v-for=item in items/>
</ul>
computed: {
_value: {
get() {
return this.item.name;
},
set(val) {
this.item.name = val; // Ошибка mutating prop
...
}
}
Answer the question
In order to leave comments, you need to log in
I don't know what you want to achieve. You can decide in different ways. But since you have items in vuex, then at least you need to use - mutations / actions
on the example of your code:
set(val) {
this.$store.dispatch('updateItem', { id: this.item.id, val });
}
<v-list-component :key="item.id">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question