deming/common/store/index.js
2020-07-16 17:39:06 +08:00

24 lines
437 B
JavaScript

import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
cartInfo: {}, // 购物车数据
orderAddress: {}, // 下单时选择的地址
},
getters: {
getOrderAddress(state) {
return state.orderAddress;
}
},
mutations: {
updateCart(state, cart) {
state.cartInfo = cart;
},
updateAddress(state, address) {
state.orderAddress = address;
}
}
})
export default store;