I want to set Vuex mutations as follows:
export default {
props: {
store: String
},
methods: {
...mapMutations({
changeModel: `${this.store}/changeModel`
})
}
}
But I catch the error:
Uncaught TypeError: Cannot read property 'store' of undefined
How do I correctly use props inside the module mutation name?
I want to map this.$store.commit('form1/changeModel')
, where form1
is set from props.
...mapMutations(['changeModel'])
? Do you want to mapthis.$store.commit('changeModel')
- or something else? – Animalizethis.$store.commit('form1/changeModel')
, whereform1
is set from props. – Pyrrolidine