24 lines
437 B
JavaScript
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; |