💄 修复元素为None时的渲染异常

This commit is contained in:
目棃
2025-02-09 19:28:23 +08:00
parent 0157ae413b
commit 06a4821888
2 changed files with 19 additions and 5 deletions

View File

@@ -7,7 +7,9 @@
<slot name="icon"><img :src="props.modelValue.icon" alt="icon" /></slot> <slot name="icon"><img :src="props.modelValue.icon" alt="icon" /></slot>
</div> </div>
<div class="tib-cover"> <div class="tib-cover">
<div class="tib-lt"><img :src="props.modelValue.lt" alt="lt" /></div> <div class="tib-lt" v-show="props.modelValue.lt !== ''">
<img :src="props.modelValue.lt" alt="lt" />
</div>
<div v-show="props.modelValue.rt" class="tib-rt">{{ props.modelValue.rt }}</div> <div v-show="props.modelValue.rt" class="tib-rt">{{ props.modelValue.rt }}</div>
<div class="tib-inner"> <div class="tib-inner">
<slot name="inner-icon"> <slot name="inner-icon">

View File

@@ -6,22 +6,34 @@
<script lang="ts" setup> <script lang="ts" setup>
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue"; import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import { getZhElement } from "@/utils/toolFunc.js"; import { getWikiBrief, getZhElement } from "@/utils/toolFunc.js";
type TucAvatarsProps = { modelValue: Array<TGApp.Game.Combat.Avatar>; detail: boolean }; type TucAvatarsProps = { modelValue: Array<TGApp.Game.Combat.Avatar>; detail: boolean };
const props = defineProps<TucAvatarsProps>(); const props = defineProps<TucAvatarsProps>();
function getItemBox(item: TGApp.Game.Combat.Avatar): TItemBoxData { function getItemBox(item: TGApp.Game.Combat.Avatar): TItemBoxData {
const findAvatar = getWikiBrief(item.avatar_id);
let innerText = item.avatar_type === 2 ? "试用角色" : item.avatar_type === 3 ? "助演角色" : "";
let findWeapon;
if (findAvatar) {
findWeapon = findAvatar.weapon;
if (innerText === "") innerText = findAvatar.name;
}
return { return {
bg: `/icon/bg/${item.rarity === 105 ? 5 : item.rarity}-BGC.webp`, bg: `/icon/bg/${item.rarity === 105 ? 5 : item.rarity}-BGC.webp`,
clickable: false, clickable: false,
display: "inner", display: "inner",
height: "80px", height: "80px",
icon: `/WIKI/character/${item.avatar_id}.webp`, icon: `/WIKI/character/${item.avatar_id}.webp`,
innerHeight: item.avatar_type !== 1 ? 20 : 0, innerHeight: innerText === "" ? 0 : 20,
innerText: item.avatar_type === 2 ? "试用角色" : item.avatar_type === 3 ? "助演角色" : "", innerText: innerText,
lt: `/icon/element/${getZhElement(item.element)}元素.webp`, lt:
item.element === "None"
? findWeapon
? `/icon/weapon/${findWeapon}.webp`
: ""
: `/icon/element/${getZhElement(item.element)}元素.webp`,
ltSize: "20px", ltSize: "20px",
innerBlur: "5px", innerBlur: "5px",
rt: "", rt: "",