帮助工具方法
npm install -S vuex_helper
import createNamespacedStore from 'vuex_helper';
import Vuex from 'vuex';
const demo = createNamespacedStore('nameSpace-demo', {
state: {
key1: ''
},
mutations: {},
...
});
const store = new Vuex.Store({
modules: {
demo
},
strict: process.env.NODE_ENV !== 'production'
});
// set module state
store.commit('nameSpace-demo/key1.set', 'key1')
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request .