🐛 fix(anno): 处理 banner 为 “” 的情况

This commit is contained in:
BTMuli
2023-04-12 17:11:53 +08:00
parent af0a5198b6
commit 1fcf47a390
2 changed files with 5 additions and 2 deletions

View File

@@ -5,6 +5,9 @@
* @since Alpha v0.1.2 * @since Alpha v0.1.2
*/ */
// 默认封面图
const defaultCover = "/source/UI/defaultCover.webp";
/** /**
* @description 将获取到的数据转为渲染用的卡片 * @description 将获取到的数据转为渲染用的卡片
* @since Alpha v0.1.2 * @since Alpha v0.1.2
@@ -19,7 +22,7 @@ export function getAnnoCard (data: BTMuli.Genshin.Announcement.ListData): BTMuli
id: anno.ann_id, id: anno.ann_id,
title: anno.title, title: anno.title,
subtitle: anno.subtitle, subtitle: anno.subtitle,
banner: anno.banner, banner: anno.banner || defaultCover,
typeLabel: anno.type_label, typeLabel: anno.type_label,
tagIcon: anno.tag_icon, tagIcon: anno.tag_icon,
startTime: anno.start_time, startTime: anno.start_time,

View File

@@ -10,7 +10,7 @@
<div class="anno-subtitle"> <div class="anno-subtitle">
{{ annoData.subtitle }} {{ annoData.subtitle }}
</div> </div>
<img :src="annoData.banner" alt="cover" class="anno-img"> <img v-if="annoData.banner !== ''" :src="annoData.banner" alt="cover" class="anno-img">
<div class="anno-content" v-html="annoHtml" /> <div class="anno-content" v-html="annoHtml" />
</div> </div>
</template> </template>