vuex-module-decorators
vuex-module-decorators copied to clipboard
Could we invoke mutation directly in action?
Code assumed:
@Mutation
increment(){
this.count++
}
@Action
act(){
this.increment() // instead of this.context.commit('increment')
}
I've seen this usage in "vue typescript admin template" and many other examples. Is that legal? But why it is not mentioned in the doc. I think it'is more convinient than commitment.
From what I have seen it does not work, this was very confusing to me. We should at least update the docs to show how this needs to be done as not everyone wants to use @MutationAction
This should be possible if you are using Dynamic Modules.
@bangjelkoski I have used this approach in static modules without any issues