Currently facing an issue. I'm unsure of how to invoke a method within a mutation method. I attempted using this.show()
, but it did not yield results. Is there a similar approach like in vuex actions where one can call a method within an action using dispatch
?
// Mutation
export default {
show(state, payload) {
// execute code
},
hide(state, payload) {
// How can I trigger the show method here?
}
}
I aspire for the mutation to resemble this:
// Action
export default {
show({ state }, payload) {
// execute code
},
hide({ dispatch, state }, payload) {
// How can I call the show method in a manner analogous to actions?
// Is achieving this possible for mutations?
return dispatch('show', payload)
}
}