mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 07:29:33 +08:00
修复大图查看页面空值处理问题:增加对 image 对象的可选链操作,防止因空值导致的错误显示或逻辑异常
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<div class="absolute inset-0 flex items-center justify-center">
|
<div class="absolute inset-0 flex items-center justify-center">
|
||||||
<img
|
<img
|
||||||
:src="getFullImageUrl()"
|
:src="getFullImageUrl()"
|
||||||
:alt="image.title || 'Bing Image'"
|
:alt="image?.title || 'Bing Image'"
|
||||||
class="max-w-full max-h-full object-contain transition-opacity duration-500 ease-in-out"
|
class="max-w-full max-h-full object-contain transition-opacity duration-500 ease-in-out"
|
||||||
:style="{ opacity: imageOpacity }"
|
:style="{ opacity: imageOpacity }"
|
||||||
/>
|
/>
|
||||||
@@ -35,14 +35,14 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="text-white/80 text-sm">
|
<div class="text-white/80 text-sm">
|
||||||
{{ formatDate(image.date) }}
|
{{ formatDate(image?.date) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 信息悬浮层(类似 Windows 聚焦) -->
|
<!-- 信息悬浮层(类似 Windows 聚焦) -->
|
||||||
<div
|
<div
|
||||||
v-if="showInfo && !showCalendar"
|
v-if="showInfo && !showCalendar && image"
|
||||||
ref="infoPanel"
|
ref="infoPanel"
|
||||||
class="fixed w-[90%] max-w-md bg-black/40 backdrop-blur-lg rounded-xl p-4 z-20 select-none"
|
class="fixed w-[90%] max-w-md bg-black/40 backdrop-blur-lg rounded-xl p-4 z-20 select-none"
|
||||||
:class="{
|
:class="{
|
||||||
@@ -63,16 +63,16 @@
|
|||||||
></div>
|
></div>
|
||||||
|
|
||||||
<h2 class="text-lg font-bold text-white mb-2 mt-2">
|
<h2 class="text-lg font-bold text-white mb-2 mt-2">
|
||||||
{{ image.title || '未命名' }}
|
{{ image?.title || '未命名' }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p v-if="image.copyright" class="text-white/80 text-xs mb-3 leading-relaxed">
|
<p v-if="image?.copyright" class="text-white/80 text-xs mb-3 leading-relaxed">
|
||||||
{{ image.copyright }}
|
{{ image.copyright }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- 版权详情链接 -->
|
<!-- 版权详情链接 -->
|
||||||
<a
|
<a
|
||||||
v-if="image.copyrightlink"
|
v-if="image?.copyrightlink"
|
||||||
:href="image.copyrightlink"
|
:href="image.copyrightlink"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="inline-flex items-center gap-2 px-3 py-1.5 bg-white/15 hover:bg-white/25 text-white rounded-lg text-xs font-medium transition-all group"
|
class="inline-flex items-center gap-2 px-3 py-1.5 bg-white/15 hover:bg-white/25 text-white rounded-lg text-xs font-medium transition-all group"
|
||||||
|
|||||||
Reference in New Issue
Block a user