Answer the question
In order to leave comments, you need to log in
How to properly copy data from Vuex?
The thing is, I need to get data from $store (vuex) into the component , work with it, and in which case save it back to vuex .
But the "situation" is (as I understand it) that the Object.assign method copies all reactivity to another array .. Well, or how to explain it, I don't know ... =(
Here is my method:
getData(){
this.allBooks = Object.assign({}, this.$store.getters.getAllBooks())
}
this.allBooks[0].title = 'test name'
console.log(this.$store.getters.getAllBooks())
Answer the question
In order to leave comments, you need to log in
Based on the principles of Vuex.
get data from $store (vuex), work with it,- getters
and in which case save back to vuex.- mutations
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question