🐛 修复分享图生成错误

This commit is contained in:
BTMuli
2023-11-25 20:27:30 +08:00
parent 5f3f6640a4
commit 3b0ed774df
4 changed files with 29 additions and 21 deletions

View File

@@ -14,7 +14,7 @@
</div>
</template>
<script lang="ts" setup>
import { onMounted, onUpdated, reactive } from "vue";
import { onMounted, onUpdated, ref } from "vue";
import { saveImgLocal } from "../../utils/TGShare";
@@ -23,21 +23,23 @@ interface DucDetailOlbProps {
}
const props = defineProps<DucDetailOlbProps>();
let constellations = reactive<TGApp.Sqlite.Character.RoleConstellation[]>([]);
const constellations = ref<TGApp.Sqlite.Character.RoleConstellation[]>([]);
function loadData() {
constellations = props.modelValue;
constellations.map(
async (constellation) => (constellation.icon = await saveImgLocal(constellation.icon)),
);
async function loadData() {
const tempConstellations = props.modelValue;
for (const constellation of tempConstellations) {
if (constellation.icon.startsWith("blob:")) return;
constellation.icon = await saveImgLocal(constellation.icon);
}
constellations.value = tempConstellations;
}
onMounted(() => {
loadData();
onMounted(async () => {
await loadData();
});
onUpdated(() => {
loadData();
onUpdated(async () => {
await loadData();
});
</script>
<style>