vuex-class-state2way
TypeScript decorator to create getters/setters for a Vuex state.
The main purpose is to use v-model
directive without the overhead of manually creating simple getters and setters.
Check vuex-class repository for a lot more Vuex decorators!
Dependencies
Installation
$ npm install --save vuex-class-state2way# or $ yarn add vuex-class-state2way
Usage
- Get
variable_name
from the state, and commit"mutation name"
to update this variable in the state
variable_name
- Get
variable_name
from the state and set its value to the variableother_name
, and commit"mutation name"
to update this variable in the state
other_name
- To get a deep value, you can do both:
fooBar // you get type checking fooBar
Example