mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🚸 部分资源释放
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="duc-dolb-box">
|
||||
<div
|
||||
v-for="constellation in constellations"
|
||||
v-for="constellation in props.modelValue"
|
||||
:key="constellation.pos"
|
||||
:title="constellation.name"
|
||||
class="duc-dolb-item"
|
||||
@@ -9,48 +9,18 @@
|
||||
<div v-if="!constellation.is_actived" class="duc-dolb-lock">
|
||||
<v-icon color="white">mdi-lock</v-icon>
|
||||
</div>
|
||||
<img class="duc-dolb-icon" :src="constellation.icon" alt="constellation" />
|
||||
<div class="duc-dolb-icon">
|
||||
<TMiImg :ori="true" :src="constellation.icon" alt="constellation" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, shallowRef, watch } from "vue";
|
||||
|
||||
import { saveImgLocal } from "@/utils/TGShare.js";
|
||||
import TMiImg from "@comp/app/t-mi-img.vue";
|
||||
|
||||
type DucDetailOlbProps = { modelValue: Array<TGApp.Game.Avatar.Constellation> };
|
||||
|
||||
const props = defineProps<DucDetailOlbProps>();
|
||||
const constellations = shallowRef<Array<TGApp.Game.Avatar.Constellation>>([]);
|
||||
|
||||
async function loadData() {
|
||||
const tempConstellations = JSON.parse(JSON.stringify(props.modelValue));
|
||||
for (const constellation of tempConstellations) {
|
||||
if (constellation.icon.startsWith("blob:")) return;
|
||||
constellation.icon = await saveImgLocal(constellation.icon);
|
||||
}
|
||||
constellations.value = tempConstellations;
|
||||
}
|
||||
|
||||
onMounted(async () => await loadData());
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
async () => {
|
||||
for (const constellation of constellations.value) {
|
||||
if (constellation.icon.startsWith("blob:")) {
|
||||
URL.revokeObjectURL(constellation.icon);
|
||||
}
|
||||
}
|
||||
await loadData();
|
||||
},
|
||||
);
|
||||
onUnmounted(() => {
|
||||
for (const constellation of constellations.value) {
|
||||
if (constellation.icon.startsWith("blob:")) {
|
||||
URL.revokeObjectURL(constellation.icon);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.duc-dolb-box {
|
||||
@@ -75,6 +45,7 @@ onUnmounted(() => {
|
||||
|
||||
.duc-dolb-lock {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
@@ -88,9 +59,20 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.duc-dolb-icon {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 5px;
|
||||
border-radius: 50%;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,54 +2,24 @@
|
||||
<div class="duc-dort-box">
|
||||
<div
|
||||
:title="talent.name"
|
||||
v-for="talent in talents"
|
||||
v-for="talent in props.modelValue"
|
||||
:key="talent.skill_id"
|
||||
class="duc-dort-item"
|
||||
>
|
||||
<span>{{ talent.name }}</span>
|
||||
<img :src="talent.icon" alt="talent" />
|
||||
<div class="duc-dort-icon">
|
||||
<TMiImg :ori="true" :src="talent.icon" alt="talent" />
|
||||
</div>
|
||||
<span>Lv.{{ talent.level === 0 ? 1 : talent.level }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, shallowRef, watch } from "vue";
|
||||
|
||||
import { saveImgLocal } from "@/utils/TGShare.js";
|
||||
import TMiImg from "@comp/app/t-mi-img.vue";
|
||||
|
||||
type DucDetailOrtProps = { modelValue: Array<TGApp.Game.Avatar.Skill> };
|
||||
|
||||
const props = defineProps<DucDetailOrtProps>();
|
||||
const talents = shallowRef<Array<TGApp.Game.Avatar.Skill>>([]);
|
||||
|
||||
async function loadData(): Promise<void> {
|
||||
const tempTalent = JSON.parse(JSON.stringify(props.modelValue));
|
||||
for (const talent of tempTalent) {
|
||||
if (talent.icon.startsWith("blob:")) return;
|
||||
talent.icon = await saveImgLocal(talent.icon);
|
||||
}
|
||||
talents.value = tempTalent;
|
||||
}
|
||||
|
||||
onMounted(async () => await loadData());
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
async () => {
|
||||
for (const talent of talents.value) {
|
||||
if (talent.icon.startsWith("blob:")) {
|
||||
URL.revokeObjectURL(talent.icon);
|
||||
}
|
||||
}
|
||||
await loadData();
|
||||
},
|
||||
);
|
||||
onUnmounted(() => {
|
||||
for (const talent of talents.value) {
|
||||
if (talent.icon.startsWith("blob:")) {
|
||||
URL.revokeObjectURL(talent.icon);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.duc-dort-box {
|
||||
@@ -61,17 +31,28 @@ onUnmounted(() => {
|
||||
.duc-dort-item {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
column-gap: 10px;
|
||||
column-gap: 8px;
|
||||
}
|
||||
|
||||
.duc-dort-item img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 5px;
|
||||
.duc-dort-icon {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
backdrop-filter: blur(5px);
|
||||
background: rgba(0 0 0 /40%);
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
.duc-dort-item span {
|
||||
@@ -83,9 +64,4 @@ onUnmounted(() => {
|
||||
font-size: 16px;
|
||||
text-shadow: 0 0 5px rgba(0 0 0/40%);
|
||||
}
|
||||
|
||||
.duc-dort-item :nth-last-child(1) {
|
||||
width: 48px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<img :src="`/icon/bg/${props.modelValue.rarity}-Star.webp`" alt="bg" />
|
||||
</div>
|
||||
<div v-if="props.modelValue" class="duc-dr-icon">
|
||||
<img :src="props.modelValue.icon" alt="relic" />
|
||||
<TMiImg :ori="true" :src="props.modelValue.icon" alt="relic" />
|
||||
</div>
|
||||
<div v-if="props.modelValue !== false" class="duc-dr-level">
|
||||
{{ props.modelValue.level }}
|
||||
@@ -15,6 +15,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import TMiImg from "@comp/app/t-mi-img.vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
type ducDetailRelicProps = { modelValue: TGApp.Game.Avatar.Relic | false; pos: number };
|
||||
@@ -61,8 +62,11 @@ const relicBg = computed<string>(() => {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.duc-dr-icon img {
|
||||
|
||||
Reference in New Issue
Block a user