diff --git a/src/components/cate/cate.vue b/src/components/cate/cate.vue index 7c3d778..fa82962 100644 --- a/src/components/cate/cate.vue +++ b/src/components/cate/cate.vue @@ -75,6 +75,10 @@ export default { type: Number, default: 0, }, + activeId: { + type: [String, Number], + default: 0, + }, data: { type: Array, default: [], @@ -108,7 +112,6 @@ export default { // H5窗口高度会计算tabbar高度,这里减去 this.wrapHeight -= this.$utils.rpx2px(100); // #endif - // this.switchCate(5); }, destroyed() {}, methods: { @@ -247,6 +250,11 @@ export default { this.$emit("clickItem", id); }, }, + watch: { + activeId(activeId) { + this.switchCate(activeId); + }, + }, }; diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue index eb1e1c7..e6ef764 100644 --- a/src/pages/service/cate.vue +++ b/src/pages/service/cate.vue @@ -49,7 +49,7 @@ export default { config: (state) => state.system.config, }), }, - onLoad() { + async onLoad() { let x = this.config.windowWidth - this.$utils.rpx2px(94); let y = this.config.windowHeight - this.$utils.rpx2px(94); // H5平台减去tabBar高度 @@ -61,7 +61,7 @@ export default { y: y - this.$utils.rpx2px(40), }; // 加载分类 - this.loadHot(); + await this.loadHot(); this.loadCate(); }, onShow() {}, @@ -72,8 +72,8 @@ export default { /** * 热门推荐 */ - loadHot() { - this.$request({ + async loadHot() { + await this.$request({ api: "service.hotCate", }).then((response) => { let child = []; @@ -95,8 +95,8 @@ export default { /** * 分类 */ - loadCate() { - this.$request({ + async loadCate() { + await this.$request({ api: "service.cate", }) .then((response) => { diff --git a/src/pages/service/list.vue b/src/pages/service/list.vue index d9e96cf..3df1af3 100644 --- a/src/pages/service/list.vue +++ b/src/pages/service/list.vue @@ -1,7 +1,7 @@