You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
507 B
JavaScript
32 lines
507 B
JavaScript
import Vue from "vue";
|
|
import Vuex from "vuex";
|
|
|
|
Vue.use(Vuex);
|
|
|
|
const store = new Vuex.Store({
|
|
state: {
|
|
$Gimage: {},
|
|
$GstoreDetail: {},
|
|
// 购物车数量
|
|
cartNum: 0,
|
|
},
|
|
getters: {
|
|
cartNum: (state) => {
|
|
return state.cartNum || 0;
|
|
},
|
|
},
|
|
mutations: {
|
|
SET: (state, { key, val }) => {
|
|
state[key] = val
|
|
},
|
|
},
|
|
actions: {
|
|
setData({ commit }, { key, val }) {
|
|
commit('SET', { key, val })
|
|
}
|
|
},
|
|
modules: {},
|
|
});
|
|
|
|
export default store;
|