fix: main data
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
v-for="(item, index) in topics"
|
||||
:key="item.id || index"
|
||||
:topic="item"
|
||||
@card-click="goToTopicDetail(item.id)"
|
||||
@item-click="goToTopicDetail(item.id)"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@@ -83,15 +83,15 @@ const loadData = async (page = 1) => {
|
||||
}
|
||||
|
||||
// 构造适合 TopicCard 渲染的数据格式
|
||||
const formattedList = list.map(item => ({
|
||||
id: item.topicId || item.id,
|
||||
title: item.topicName || item.title || '未知话题',
|
||||
image: item.image || item.coverUrl || 'https://api.dicebear.com/7.x/shapes/svg?seed=' + (item.topicId || item.id), // 给个默认图防止报错
|
||||
views: item.participantCount || item.views || 0,
|
||||
items: item.items || item.ratingItems || []
|
||||
}));
|
||||
// const formattedList = list.map(item => ({
|
||||
// id: item.topicId || item.id,
|
||||
// title: item.topicName || item.title || '未知话题',
|
||||
// image: item.image || item.coverUrl || 'https://api.dicebear.com/7.x/shapes/svg?seed=' + (item.topicId || item.id), // 给个默认图防止报错
|
||||
// views: item.participantCount || item.views || 0,
|
||||
// items: item.items || item.ratingItems || []
|
||||
// }));
|
||||
|
||||
topics.value = [...topics.value, ...formattedList];
|
||||
topics.value = [...topics.value, ...list];
|
||||
|
||||
// 判断是否有下一页
|
||||
hasMore.value = list.length >= pageSize;
|
||||
|
||||
Reference in New Issue
Block a user