1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-07-27 04:20:43 +08:00

1 Commits

Author SHA1 Message Date
小莫唐尼 1407b58024 fix: 修复分类统计显示undefined问题 #42 2026-07-20 16:21:18 +08:00
3 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ const UHaloBaseConfig = Object.freeze({
/** 基础请求域名:你的Halo博客基础域名,注意,域名后面不能带有斜杠【/】 */
// BASE_API: "",
// 示例:
BASE_API: "https://blog.xiaoxiaomo.cn",
BASE_API: "http://localhost:8090",
// todo:可能有其他配置
})
+3 -3
View File
@@ -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;
+4 -1
View File
@@ -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;
});