2👍
emphasized textIn your mutations, you are accessing the state using this.$store.state
. This is wrong as this
does not point to the vue instance.
The mutation handler receives the state
as the first argument:
myMutation(state){
//use state argumentt to access state
}
Here is the updated code sandbox
One more thing: mapMutations
is a helper which maps component methods to store.commit
calls. So they are just methods in the component Add it to methods
option not the computed
as they are not computing anything
0👍
Pass state as an argument in your mutations’ functions like this:
increment(state) {
state.stake.value += 1;
},
You don’t need to do this.$store in your store. Only in your vue components
👤LJD
- [Vuejs]-Firestore Promises Query Collection in For Loop (Nuxt.js)
- [Vuejs]-Firestore Promises Query Collection in For Loop (Nuxt.js)
Source:stackexchange.com