分类列表点击事件添加parentId

This commit is contained in:
TOP糯米 2023-03-08 22:29:55 +08:00
parent 8d202a25b4
commit 35b5535a97
5 changed files with 16 additions and 8 deletions

View File

@ -36,8 +36,8 @@
:key="index"
:style="{ height: index == data.length - 1 ? wrapHeight + utils.rpx2px(110) + 'px' : 'auto' }"
>
<cate-tmpl v-if="cateType === 'cate'" :data="item" @clickItem="clickItem"></cate-tmpl>
<list-tmpl v-if="cateType === 'list'" :data="item" @clickItem="clickItem"></list-tmpl>
<cate-tmpl v-if="cateType === 'cate'" :parentId="item.id" :data="item" @clickItem="clickItem"></cate-tmpl>
<list-tmpl v-if="cateType === 'list'" :parentId="item.id" :data="item" @clickItem="clickItem"></list-tmpl>
</view>
</view>
</scroll-view>
@ -247,8 +247,8 @@ export default {
});
this.swichMenu(this.activeIndex);
},
clickItem(id) {
this.$emit("clickItem", id);
clickItem(parentId, id) {
this.$emit("clickItem", parentId, id);
},
},
watch: {

View File

@ -19,6 +19,10 @@ export default {
return {};
},
props: {
parentId: {
type: Number,
default: 0,
},
data: {
type: Object,
default: [],
@ -30,7 +34,7 @@ export default {
destroyed() {},
methods: {
clickItem(id) {
this.$emit("clickItem", id);
this.$emit("clickItem", this.parentId, id);
},
},
};

View File

@ -21,6 +21,10 @@ export default {
return {};
},
props: {
parentId: {
type: Number,
default: 0,
},
data: {
type: Object,
default: [],
@ -35,7 +39,7 @@ export default {
destroyed() {},
methods: {
clickItem(id) {
this.$emit("clickItem", id);
this.$emit("clickItem", this.parentId, id);
},
},
};

View File

@ -117,7 +117,7 @@ export default {
})
.catch((e) => {});
},
clickItem(id) {
clickItem(parentId, id) {
this.$utils.toPage("/pages/service/list?id=" + id);
},
},

View File

@ -87,7 +87,7 @@ export default {
createOrder() {
this.$utils.toPage("/pages/order/create");
},
clickItem(id) {
clickItem(parentId, id) {
this.$utils.toPage("/pages/service/detail?id=" + id);
},
},