Answer the question
In order to leave comments, you need to log in
How to split data in Vuex?
Actually, the question is this - you need to store states in vuex, but I would not want to mix them all together. I’ll make a reservation right away - we won’t use modules (yet). I'm trying to implement this through objects like:
someState:{
state1:value,
state2:value,
...
stateN:value
}
Answer the question
In order to leave comments, you need to log in
The answer is (see comments above):
Link to sample code: https://codepen.io/kerf/pen/Ngxmem
This assignment will only work once when the component is initialized:
data() {
return {
selected: this.value
}
watch: {
value: function () {
this.selected = this.value
}
}
beforeUpdate() {
this.selected = this.value
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question