From 1407b5802422dca73003d8099d36da882cc3a1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Mon, 20 Jul 2026 16:21:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=98=BE=E7=A4=BAundefined=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/uhalo.config.js | 2 +- pages/tabbar/category/category.vue | 6 +++--- pages/tabbar/home/home.vue | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config/uhalo.config.js b/config/uhalo.config.js index 5083f7d..c128ac8 100644 --- a/config/uhalo.config.js +++ b/config/uhalo.config.js @@ -4,7 +4,7 @@ const UHaloBaseConfig = Object.freeze({ /** 基础请求域名:你的Halo博客基础域名,注意,域名后面不能带有斜杠【/】 */ // BASE_API: "", // 示例: - BASE_API: "https://blog.xiaoxiaomo.cn", + BASE_API: "http://localhost:8090", // todo:可能有其他配置 }) diff --git a/pages/tabbar/category/category.vue b/pages/tabbar/category/category.vue index 57204e0..6a39428 100644 --- a/pages/tabbar/category/category.vue +++ b/pages/tabbar/category/category.vue @@ -240,8 +240,6 @@ export default { this.$httpApi.v2 .getCategoryList(this.queryParams) .then(res => { - console.log('请求结果:'); - console.log(res); if (this.calcShowType === 'list') { this.loading = 'success'; this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~'; @@ -249,6 +247,7 @@ export default { this.hasNext = res.hasNext; const tempItems = res.items.map(item => { + item.postCount = item.postCount ?? 0 item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true) return item; }) @@ -262,9 +261,10 @@ export default { this.dataList = res.items this.categoryList = res.items.map(item => { return { + ...item, displayName: item.spec.displayName, name: item.metadata.name, - ...item, + postCount: item.postCount ?? 0 } }) this.triggered = false; diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index 89a872b..dc217dc 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -275,7 +275,10 @@ fieldSelector: ['spec.hideFromList=false'] }) .then(res => { - this.categoryList = res.items.sort((a, b) => { + this.categoryList = res.items.map(item=>{ + item.postCount = item.postCount ?? 0 + return item; + }).sort((a, b) => { return b.postCount - a.postCount; });