Answer the question
In order to leave comments, you need to log in
Why is the error "[vuex] do not mutate vuex store state outside mutation handlers." in the NUXT project?
There is a module in the Store, like this:
export const state = () => ({
list: []
})
export const mutations = {
addToListM(state, data) {
state.list.push(data)
}
}
export const getters = {
getList: (state) => {
return state.list
}
}
resultToList() {
this.$store.dispatch('transportcalc/addToList', {params: this.params, indices: this.indices, result: this.result, description: ''})
this.result = false
this.indices = false
this.volume = ''
this.power = ''
}
computed: {
list: {
get() {
return this.$store.getters['transportcalc/getList']
},
set() {
}
}
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question