Vue Decorators
This is Vue Decorators v1.1.7 (beta)
Vue & Vuex Decorators for ECMAscript
Dependencies
Installation
npm install --save vue-decorators
Decorators
Vue-decorators has many decorators, for example:
-
@Component
or@Component({ ... })
-
@InjectComponents({ ... })
-
@Prop
or@Prop({ ... })
-
@Watch
or@Watch('...')
-
@Lifecycle
or@Lifecycle('...')
-
@Filter
or@Filter('...')
-
@Computed
-
@State
or@State('...')
-
@Action
or@Action('...')
-
@Getter
or@Getter('...')
-
@Mutation
or@Mutation('...')
Other decorators you can see in the documentation.
Example for Vue components
;;; @Component@ credentials = username: '' password: '' ; otherData = 123; @Prop property1; @ property2; @ property3; @Action login; @Getter currentUser; @ { /* ... */ } @Lifecycle { /* ... */ } @Computed { /* ... */ } @Filter { /* ... */ } { /* ... */ this; }
Example for Stores
// store/modules/auth.js; @Module @State currentUser = null; @Action { // ... } @Getter { return statecurrentUser; } @Mutation { statecurrentUser = currentUser; }
// store/index.js;;;; ; Vue; @@@Store @State rootExampleState = 'foo'; @Action { /* ... */ }
License
MIT