Merge pull request '7.15' (#64) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/64
This commit is contained in:
hansu 2020-07-15 17:40:13 +08:00
commit da9967405a
3 changed files with 24 additions and 46 deletions

View File

@ -1,41 +1,20 @@
// 商品相关 import Vue from 'vue'
const moduleA = { import Vuex from 'vuex'
state: () => ({ Vue.use(Vuex)
count: 0
}),
mutations: {
increment (state) {
// 这里的 `state` 对象是模块的局部状态
state.count++
}
},
getters: {
doubleCount (state) {
return state.count * 2
}
}
}
// 用户相关
const moduleB = {
state: () => ({
count: 0
}),
mutations: {
increment (state) {
// 这里的 `state` 对象是模块的局部状态
state.count++
}
},
getters: {
doubleCount (state) {
return state.count * 2
}
}
}
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { state: {
shop: moduleA, count: 0
user: moduleB },
getters: {
doubleCount (state) {
return state.count * 2
}
},
mutations: {
increment (state) {
state.count++
}
} }
}) })
export default store;

View File

@ -1,17 +1,17 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App' import App from './App'
import uView from "uview-ui"; import uView from "uview-ui";
// import Vuex from 'vuex'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(uView); Vue.use(uView);
// Vue.use(Vuex);
App.mpType = 'app' App.mpType = 'app'
// import store from '@/common/store/index.js' import store from '@/common/store/index.js'
Vue.prototype.$store = store;
const app = new Vue({ const app = new Vue({
...App, ...App,
// store store
}) })
// http拦截器将此部分放在new Vue()和app.$mount()之间才能App.vue中正常使用 // http拦截器将此部分放在new Vue()和app.$mount()之间才能App.vue中正常使用
import httpInterceptor from '@/common/http.interceptor.js' import httpInterceptor from '@/common/http.interceptor.js'

View File

@ -41,8 +41,8 @@
<view class="hr" style="margin-top:40rpx"></view> <view class="hr" style="margin-top:40rpx"></view>
<seckill v-if="spikeList.length"></seckill> <seckill v-if="spikeList.length"></seckill>
<view v-if="spikeList.length" class="hr" style="margin-top:40rpx"></view> <view v-if="spikeList.length" class="hr" style="margin-top:40rpx"></view>
<!-- <recommend></recommend> --> <recommend v-if="0"></recommend>
<!-- <view class="hr" style="margin-top:40rpx"></view> --> <view class="hr" style="margin-top:40rpx" v-if="0"></view>
<group></group> <group></group>
<image class="lingquan"></image> <image class="lingquan"></image>
<youhq></youhq> <youhq></youhq>
@ -95,7 +95,6 @@ export default {
this.getGoodsRecommend(); this.getGoodsRecommend();
}, },
onShow() { onShow() {
// console.log(this.$store.shop.state.count);
this.getRecommendedSpike(); this.getRecommendedSpike();
this.getSpikeList(); this.getSpikeList();
}, },