Initial commit
This commit is contained in:
24
store/index.js
Normal file
24
store/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
|
||||
Vue.use(Vuex); //vue的插件机制
|
||||
|
||||
//Vuex.Store 构造器选项
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
current: 0,
|
||||
resources: [],
|
||||
},
|
||||
mutations: {
|
||||
SET_RESOURCES(state, data) {
|
||||
state.resources = data;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setResources({ commit }, data) {
|
||||
commit("SET_RESOURCES", data);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default store;
|
||||
Reference in New Issue
Block a user