deming/common/store/index.js

24 lines
437 B
JavaScript
Raw Normal View History

2020-07-15 09:38:41 +00:00
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
2020-07-16 09:39:06 +00:00
cartInfo: {}, // 购物车数据
orderAddress: {}, // 下单时选择的地址
2020-07-15 08:21:43 +00:00
},
getters: {
2020-07-16 09:39:06 +00:00
getOrderAddress(state) {
return state.orderAddress;
2020-07-15 08:21:43 +00:00
}
2020-07-15 09:38:41 +00:00
},
2020-07-15 08:21:43 +00:00
mutations: {
2020-07-16 09:39:06 +00:00
updateCart(state, cart) {
state.cartInfo = cart;
},
updateAddress(state, address) {
state.orderAddress = address;
2020-07-15 08:21:43 +00:00
}
}
2020-07-15 09:38:41 +00:00
})
export default store;