mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🐛 修复分享图角色image渲染异常
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tua-dc-container">
|
<div class="tua-dc-container">
|
||||||
<img :src="props.modelValue.avatar.image" class="tua-dc-avatar" alt="avatar" />
|
<img :src="avatar" class="tua-dc-avatar" alt="avatar" />
|
||||||
<v-btn
|
<v-btn
|
||||||
class="tua-dc-share"
|
class="tua-dc-share"
|
||||||
prepend-icon="mdi-share-variant"
|
prepend-icon="mdi-share-variant"
|
||||||
@@ -46,11 +46,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref, watch } from "vue";
|
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||||
|
|
||||||
import TSUserAvatar from "../../plugins/Sqlite/modules/userAvatar.js";
|
import TSUserAvatar from "../../plugins/Sqlite/modules/userAvatar.js";
|
||||||
import { useUserStore } from "../../store/modules/user.js";
|
import { useUserStore } from "../../store/modules/user.js";
|
||||||
import { generateShareImg } from "../../utils/TGShare.js";
|
import { generateShareImg, saveImgLocal } from "../../utils/TGShare.js";
|
||||||
|
|
||||||
import TuaDcConstellations from "./tua-dc-constellations.vue";
|
import TuaDcConstellations from "./tua-dc-constellations.vue";
|
||||||
import TuaDcProp from "./tua-dc-prop.vue";
|
import TuaDcProp from "./tua-dc-prop.vue";
|
||||||
@@ -84,15 +84,26 @@ const propMain = computed<Array<TGApp.Game.Avatar.PropMapItem | false>>(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const bg = ref<string>("/source/nameCard/profile/原神·印象.webp");
|
const bg = ref<string>("/source/nameCard/profile/原神·印象.webp");
|
||||||
|
const avatar = ref<string>(props.modelValue.avatar.image);
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadData();
|
await loadData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (avatar.value.startsWith("blob:")) {
|
||||||
|
URL.revokeObjectURL(avatar.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
async () => {
|
async () => {
|
||||||
|
if (avatar.value.startsWith("blob:")) {
|
||||||
|
URL.revokeObjectURL(avatar.value);
|
||||||
|
}
|
||||||
|
avatar.value = props.modelValue.avatar.image;
|
||||||
await loadData();
|
await loadData();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -108,6 +119,9 @@ async function loadData(): Promise<void> {
|
|||||||
bg.value = "url('/source/nameCard/profile/原神·印象.webp')";
|
bg.value = "url('/source/nameCard/profile/原神·印象.webp')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!avatar.value.startsWith("blob:")) {
|
||||||
|
avatar.value = await saveImgLocal(props.modelValue.avatar.image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function share(): Promise<void> {
|
async function share(): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user