完成首页分类跳转
This commit is contained in:
parent
d39cc6a2fb
commit
cf54b40b29
|
@ -37,7 +37,7 @@
|
|||
class="service-item"
|
||||
v-for="(item, index) in installServiceList"
|
||||
:key="index"
|
||||
@click="utils.toPage(item.page)"
|
||||
@click="toInstallService(item.id)"
|
||||
>
|
||||
<image class="service-icon" :src="item.cover" mode="scaleToFill" />
|
||||
<text class="service-name limit-line clamp-1">
|
||||
|
@ -163,7 +163,12 @@ export default {
|
|||
onReady() {},
|
||||
onReachBottom() {},
|
||||
onPullDownRefresh() {},
|
||||
methods: {},
|
||||
methods: {
|
||||
toInstallService(id) {
|
||||
this.$store.commit("system/indexCateId", id);
|
||||
this.$utils.toPage("/pages/service/cate", {}, "switch");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<widget-search />
|
||||
</view>
|
||||
<view class="cate">
|
||||
<app-cate :offsetHeight="95" :data="data" cateType="cate" @clickItem="clickItem" />
|
||||
<app-cate :offsetHeight="95" :data="data" cateType="cate" @clickItem="clickItem" :activeId="currentId" />
|
||||
</view>
|
||||
<movable-area class="cart-icon-box">
|
||||
<movable-view
|
||||
|
@ -36,6 +36,7 @@ export default {
|
|||
return {
|
||||
utils: this.$utils,
|
||||
position: { x: 300, y: 1000 },
|
||||
currentId: 0,
|
||||
data: [],
|
||||
};
|
||||
},
|
||||
|
@ -44,6 +45,11 @@ export default {
|
|||
AppCate,
|
||||
WidgetSearch,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
indexCateId: (state) => state.system.indexCateId,
|
||||
}),
|
||||
},
|
||||
async onLoad() {
|
||||
let pageConfig = getApp().globalData.pageConfig;
|
||||
|
||||
|
@ -66,7 +72,9 @@ export default {
|
|||
});
|
||||
this.loadCate();
|
||||
},
|
||||
onShow() {},
|
||||
onShow() {
|
||||
this.currentId = this.indexCateId;
|
||||
},
|
||||
onReady() {},
|
||||
onReachBottom() {},
|
||||
onPullDownRefresh() {},
|
||||
|
@ -93,8 +101,8 @@ export default {
|
|||
/**
|
||||
* 分类
|
||||
*/
|
||||
async loadCate() {
|
||||
await this.$request({
|
||||
loadCate() {
|
||||
this.$request({
|
||||
api: "service.cate",
|
||||
})
|
||||
.then((response) => {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import system from "@/store/modules/system"
|
||||
import user from "@/store/modules/user"
|
||||
|
||||
Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
system,
|
||||
user,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
indexCateId: 0,
|
||||
},
|
||||
getters: {},
|
||||
mutations: {
|
||||
indexCateId(state, data) {
|
||||
state.indexCateId = data;
|
||||
}
|
||||
},
|
||||
actions: {}
|
||||
}
|
Loading…
Reference in New Issue