From 528c3c10f1101e94aaf5c60dd8572a742b20a8e8 Mon Sep 17 00:00:00 2001
From: tj <1378534974@qq.com>
Date: 星期四, 29 五月 2025 09:26:35 +0800
Subject: [PATCH] fixed
---
pages/home/home.vue | 10 +++++++---
sub-pages/mine/index.vue | 4 ++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 012b8ac..bc09653 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -86,14 +86,18 @@
// 分页后的数组,每页3条
const pagedTripCards = computed(() => {
const pages: FilmWorks[][] = []
- for (let i = 0; i < tripCardList.value.length; i += pageSize) {
- pages.push(tripCardList.value.slice(i, i + pageSize))
+ const list = tripCardList.value || [] // 安全兜底
+ for (let i = 0; i < list.length; i += pageSize) {
+ pages.push(list.slice(i, i + pageSize))
}
return pages
})
// 总页数
-const totalPages = computed(() => Math.ceil(tripCardList.value.length / pageSize))
+const totalPages = computed(() => {
+ const list = tripCardList.value || [] // 安全兜底
+ return Math.ceil(list.length / pageSize)
+})
// 场景博物馆卡片数据
const cardList = ref([
diff --git a/sub-pages/mine/index.vue b/sub-pages/mine/index.vue
index 6a80c45..6b913e7 100644
--- a/sub-pages/mine/index.vue
+++ b/sub-pages/mine/index.vue
@@ -12,8 +12,8 @@
<view class="profile-content">
<view class="profile-header">
<view class="avatar-container">
- <image v-if="userStore.userInfo.customerDTO.cover" class="avatar"
- :src="userStore.userInfo.customerDTO.cover" mode="aspectFill" />
+ <image v-if="userStore?.userInfo?.customerDTO?.cover" class="avatar"
+ :src="userStore?.userInfo?.customerDTO?.cover" mode="aspectFill" />
<image v-else class="avatar"
src="https://ai-public.mastergo.com/ai/img_res/e8ae645c666c247b895b488e60b048f5.jpg" mode="aspectFill" />
<view class="add-icon">
--
Gitblit v1.9.3