mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🐛 修复未装配圣遗物时的渲染异常(2周目)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<div class="duc-doc-lt">
|
||||
<DucDetailOlt :data="props.dataVal" mode="avatar" />
|
||||
<DucDetailOlt :data="JSON.parse(props.dataVal.weapon)" mode="weapon" />
|
||||
<DucDetailRelics :data="JSON.parse(props.dataVal.reliquary)" />
|
||||
<DucDetailRelics :data="props.dataVal.reliquary" />
|
||||
</div>
|
||||
<v-btn
|
||||
class="duc-doc-btn"
|
||||
@@ -99,6 +99,8 @@ onMounted(async () => {
|
||||
});
|
||||
onUpdated(async () => {
|
||||
await loadData();
|
||||
console.log("updated, loadData");
|
||||
console.log(props.dataVal);
|
||||
});
|
||||
|
||||
async function loadData(): Promise<void> {
|
||||
|
||||
@@ -14,18 +14,25 @@ import { computed } from "vue";
|
||||
import DucDetailRelic from "./duc-detail-relic.vue";
|
||||
|
||||
interface DucDetailRelicsProps {
|
||||
data: TGApp.Sqlite.Character.RoleReliquary[];
|
||||
data: string;
|
||||
}
|
||||
|
||||
const props = defineProps<DucDetailRelicsProps>();
|
||||
const transData = computed(() => {
|
||||
let relics: (TGApp.Sqlite.Character.RoleReliquary | false)[] = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const relic = props.data.find((relic) => relic.pos === i + 1);
|
||||
if (relic) relics.push(relic);
|
||||
else relics.push(false);
|
||||
const transData = computed<Array<TGApp.Sqlite.Character.RoleReliquary | false>>(() => {
|
||||
if (!props.data || props.data === "") return [false, false, false, false, false];
|
||||
try {
|
||||
const parsedData: TGApp.Sqlite.Character.RoleReliquary[] = JSON.parse(props.data);
|
||||
let relics: Array<TGApp.Sqlite.Character.RoleReliquary | false> = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const relic = parsedData.find((relic) => relic.pos === i + 1);
|
||||
if (relic) relics.push(relic);
|
||||
else relics.push(false);
|
||||
}
|
||||
return relics;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [false, false, false, false, false];
|
||||
}
|
||||
return relics;
|
||||
});
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
Reference in New Issue
Block a user