Skip to content

Commit f2ac6bd

Browse files
SkyBird233HouLiXieBuRou
authored andcommitted
fix: news categories
1 parent 27f52b4 commit f2ac6bd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

components/CategoryList.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const props = defineProps<{
1010
1111
const { data, error, status } = await useAsyncData(
1212
computed(
13-
() => `${locale.value}:CategoriesList:${props.category}:${props.limit}`
13+
() =>
14+
`${locale.value}:CategoryList:${props.category}:${props.limit}:${props.filters?.map((obj) => `${obj.key}-${obj.value}`).join('--')}`
1415
),
1516
queryCollectionCategory(props.category, props.limit, props.filters)
1617
);
@@ -29,7 +30,9 @@ const { data, error, status } = await useAsyncData(
2930
<span class="flex-1 truncate">
3031
{{ item.title }}
3132
</span>
32-
<span v-if="item.date" class="pr-6">[{{ item.date.split('T')[0] }}]</span>
33+
<span v-if="item.date" class="pr-6">
34+
[{{ item.date.split('T')[0] }}]
35+
</span>
3336
</NuxtLinkLocale>
3437
</div>
3538
</div>

pages/news/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const textValue = tm('news.index');
44
// const linkValue = tm('allUniversalLink');
55
const newsLimit = 10;
66
useHead({ title: textValue.title });
7-
const filters = (newsCategory) => [{ key: 'categories', value: newsCategory }];
7+
const filters = (newsCategory) => [{ key: 'categories', value: `%"${newsCategory}"%` }];
88
</script>
99

1010
<template>

0 commit comments

Comments
 (0)