Reputation: 1564
I have this store
store/r2o.ts
import { Module, VuexModule, Mutation } from 'vuex-module-decorators'
import { IR2O } from '~/models/R2O'
@Module({
name: 'r2o',
namespaced: true
})
export default class R2O extends VuexModule {
r2os: Array<IR2O> = []
@Mutation
set(p: Array<IR2O>) {
this.r2os = p
}
}
I need to call this mutation
in my component
how can i do it ??
Upvotes: 1
Views: 649
Reputation: 513
If you want to do it directly
this.$store.commit('r2o/set', [])
If you want to use vuex-class
import { namespace } from 'vuex-class'
...
@namespace('r2o').Mutation('set') setR2o: (p: Array<IR20>) => any
myMethod() {
this.setR2o([])
}
Upvotes: 1