7.16
This commit is contained in:
@@ -4,16 +4,20 @@ Vue.use(Vuex)
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
count: 0
|
||||
cartInfo: {}, // 购物车数据
|
||||
orderAddress: {}, // 下单时选择的地址
|
||||
},
|
||||
getters: {
|
||||
doubleCount (state) {
|
||||
return state.count * 2
|
||||
getOrderAddress(state) {
|
||||
return state.orderAddress;
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
increment (state) {
|
||||
state.count++
|
||||
updateCart(state, cart) {
|
||||
state.cartInfo = cart;
|
||||
},
|
||||
updateAddress(state, address) {
|
||||
state.orderAddress = address;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user