- Vuex state is single state tree, that means you can have only one store per application.
- You can separate out multiple modules in once store and access them.
export default new Vuex.Store({
state: {
a: 1
b: 2
},
actions: {
//....
},
mutations: {
//....
}
});
const app = new Vue({
el: '#app',
// provide the store using the "store" option.
store
});
created() { //created event of your component
this.$store.state
}