fix topic display

This commit is contained in:
2024-05-11 01:09:42 +08:00
parent 53fb6202fe
commit 6f73df9605

View File

@@ -318,7 +318,7 @@ onMounted(async () => {
</NDivider> </NDivider>
<NFlex align="center" justify="center"> <NFlex align="center" justify="center">
<NPagination <NPagination
v-if="comments && (comments?.data.length ?? 0) > 0" v-if="comments && (comments?.data?.length ?? 0) > 0"
v-model:page="pn" v-model:page="pn"
:item-count="comments?.data.length ?? 0" :item-count="comments?.data.length ?? 0"
:page-size="ps" :page-size="ps"
@@ -327,14 +327,14 @@ onMounted(async () => {
/> />
</NFlex> </NFlex>
<br /> <br />
<NEmpty v-if="!comments || comments.data.length === 0" description="暂无评论" /> <NEmpty v-if="!comments || !comments.data || comments.data.length === 0" description="暂无评论" />
<NList v-else hoverable bordered size="small"> <NList v-else hoverable bordered size="small">
<NListItem v-for="item in comments.data" :key="item.id"> <NListItem v-for="item in comments.data" :key="item.id">
<ForumCommentItem :item="item" :topic="topic" @delete="onDeleteComment" /> <ForumCommentItem :item="item" :topic="topic" @delete="onDeleteComment" />
</NListItem> </NListItem>
</NList> </NList>
<br /> <br />
<NFlex v-if="(comments?.data.length ?? 0) > 5" align="center" justify="center"> <NFlex v-if="(comments?.data?.length ?? 0) > 5" align="center" justify="center">
<NPagination <NPagination
v-if="comments && (comments?.data.length ?? 0) > 0" v-if="comments && (comments?.data.length ?? 0) > 0"
v-model:page="pn" v-model:page="pn"