diff --git a/pages.json b/pages.json index 78589ad..62031d8 100644 --- a/pages.json +++ b/pages.json @@ -11,6 +11,12 @@ "style": { "navigationStyle": "custom" } + }, + { + "path": "pages/category/category", + "style": { + "navigationStyle": "custom" + } } ], "globalStyle": { diff --git a/pages/category/category.vue b/pages/category/category.vue new file mode 100644 index 0000000..3c360ef --- /dev/null +++ b/pages/category/category.vue @@ -0,0 +1,495 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index 5986820..41a7307 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -465,9 +465,19 @@ }); }, switchTab(index) { + const tab = this.navList[index]; + const catId = tab.cat_id; + const tabName = tab.name; + + if (catId > 0) { + // 跳转到独立的分类商品列表页 + uni.navigateTo({ + url: `/pages/category/category?cat_id=${catId}` + }); + return; + } + this.currentTab = index; - const tabName = this.navList[index].name; - this.scrollTarget = ''; // 重置目标,确保下次点击仍能触发滚动 this.$nextTick(() => { if (tabName === '推荐') {