vuex-class-decorator
Via vuex-class
Binding helpers for Vuex and vue-class-component
Dependencies
Installation
$ npm i -S felix307253927/vuex-class
Example
import Vue from 'vue'
import {
State,
Getter,
Action,
Mutation,
GetterSetter,
Component,
namespace
} from 'vuex-class'
const someModule = namespace('path/to/module')
@Component
export class MyComp extends Vue {
@State('foo') stateFoo
@State(state => state.bar) stateBar
@Getter('foo') getterFoo
@Action('foo') actionFoo
@Mutation('foo') mutationFoo
@someModule.Getter('foo') moduleGetterFoo
@GetterSetter('getterKey','setterKey') gsFoo:string
@State foo
@Getter bar
@Action baz
@Mutation qux
@GetterSetter bar:number
@someModule.GetterSetter name:stringg
created () {
this.stateFoo
this.stateBar
this.getterFoo
this.actionFoo({ value: true })
this.mutationFoo({ value: true })
this.moduleGetterFoo
this.bar
this.bar = 1
this.foo = 'test'
this.name
this.name = 'myname'
}
}
License
MIT