mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-16 09:58:13 +08:00
♻️ itemBox 组件重构,更加自由
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<TItemBox :data="character as Record<string,string|number>" size="80px" model-value="abyss-overview" display="inner" />
|
||||
<TItemBox :model-value="box" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { onMounted, ref } from "vue";
|
||||
import TItemBox from "../main/t-itembox.vue";
|
||||
import TItemBox, { TItemBoxData } from "../main/t-itembox.vue";
|
||||
// utils
|
||||
import TGSqlite from "../../plugins/Sqlite";
|
||||
|
||||
@@ -12,19 +12,21 @@ interface TibAbyssOverviewProps {
|
||||
modelValue: TGApp.Sqlite.Abyss.Character;
|
||||
}
|
||||
|
||||
export interface TibAbyssOverviewAvatar extends TGApp.Sqlite.Character.AppData {
|
||||
value: number,
|
||||
}
|
||||
|
||||
const props = defineProps<TibAbyssOverviewProps>();
|
||||
|
||||
const character = ref({} as TibAbyssOverviewAvatar);
|
||||
const box = ref({} as TItemBoxData);
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await TGSqlite.getAppCharacter(props.modelValue.id);
|
||||
character.value = {
|
||||
...res,
|
||||
value: props.modelValue.value,
|
||||
} as TibAbyssOverviewAvatar;
|
||||
box.value = {
|
||||
height: "80px",
|
||||
ltSize: "30px",
|
||||
bg: `/icon/bg/${props.modelValue.star}-Star.webp`,
|
||||
icon: `/WIKI/character/icon/${props.modelValue.id}.webp`,
|
||||
lt: `/icon/element/${res.element}元素.webp`,
|
||||
innerText: props.modelValue.value.toString(),
|
||||
display: "inner",
|
||||
size: "80px",
|
||||
innerHeight: 20,
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user