first commit
This commit is contained in:
34
金壶/appV1/store/index.js
Normal file
34
金壶/appV1/store/index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import Vue from "vue"
|
||||
import Vuex from "vuex"
|
||||
|
||||
import cart from "@/store/modules/cart.js"
|
||||
import path from "@/store/modules/path.js"
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state:{
|
||||
goods_id:'',
|
||||
shooppingCar_num: 0
|
||||
},
|
||||
getters: {
|
||||
// 获取购物车数量
|
||||
GetShopCarNums: (state) => {
|
||||
return state.shooppingCar_num
|
||||
}
|
||||
},
|
||||
mutations:{
|
||||
goodid(state,data){
|
||||
state.goods_id = data
|
||||
},
|
||||
SetShopCarNums: (state, Nums = null) => {
|
||||
Nums == null ? state.shooppingCar_num += 1 : state.shooppingCar_num = Nums
|
||||
// 本地保存购买数量
|
||||
uni.setStorageSync('GoodNums', state.shooppingCar_num);
|
||||
}
|
||||
},
|
||||
modules:{
|
||||
cart,
|
||||
path,
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user