diff --git a/components-diy/diy-category-item.vue b/components-diy/diy-category-item.vue index a3820e3..52a23a0 100644 --- a/components-diy/diy-category-item.vue +++ b/components-diy/diy-category-item.vue @@ -352,8 +352,11 @@ export default { this.type = this.value.template == 1 ? 'category' : 'goods'; if (this.index == this.select && this.pageIndex == 0) this.getGoodsList(); this.loadType = this.value.goodsLevel == 1 && this.value.loadType == 'all' ? 'all' : 'part'; - console.log('diy-category-item type:', this.type, 'value.level:', this.value.level, 'typeof value.level:', typeof this.value.level); - console.log('diy-category-item category.child_list:', this.category.child_list, 'length:', this.category.child_list ? this.category.child_list.length : 'undefined'); + if (this.index == this.select && parseInt(this.value.level) == 2 && this.category.child_list && this.category.child_list.length > 0) { + this.selectedSecondCategory = this.category.child_list[0].category_id; + this.secondCategoryGoodsList = []; + this.getSecondCategoryGoods(this.category.child_list[0].category_id); + } }, mounted() { setTimeout(() => { @@ -363,6 +366,11 @@ export default { if (data) this.contentWrapHeight = data.height; }).exec(); }, 1000); + if (parseInt(this.value.level) == 2 && this.category.child_list && this.category.child_list.length > 0) { + this.selectedSecondCategory = this.category.child_list[0].category_id; + this.secondCategoryGoodsList = []; + this.getSecondCategoryGoods(this.category.child_list[0].category_id); + } }, watch: { oneCategorySelect: function () { @@ -391,6 +399,11 @@ export default { } else if (this.loadType == 'part') { this.scrollTop = -1; } + if (parseInt(this.value.level) == 2 && this.category.child_list && this.category.child_list.length > 0) { + this.selectedSecondCategory = this.category.child_list[0].category_id; + this.secondCategoryGoodsList = []; + this.getSecondCategoryGoods(this.category.child_list[0].category_id); + } }, 'globalStoreInfo.store_id': { handler(nval, oval) {