npm.io
0.0.1-fixed • Published 6 years ago

vuex-declaration

Licence
ISC
Version
0.0.1-fixed
Deps
0
Size
308 kB
Vulns
0
Weekly
0

Vuex Declaration

Declare state like props, make state inject to vuex dynamically when component created.

Usage

npm i vuex-declaration
import vuecDeclaration from 'vuex-declaration'
import Vue from 'vue'
Vue.use( vuexDeclaration );
Vue.component( 'self-component', {
    data () { ... },
    props : [ ... ],
    created () { ... },

    state : [ 'state-a', 'state-b' ],
} )
export default {
    state : {
        'state-a' : {
            module : 'module-a',
        }
    }
}