mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🏷️ 修复类型错误
This commit is contained in:
@@ -59,9 +59,9 @@ interface TwcWeaponProps {
|
|||||||
item: TGApp.App.Weapon.WikiBriefInfo;
|
item: TGApp.App.Weapon.WikiBriefInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TwcWeaponEmits {
|
type TwcWeaponEmits = {
|
||||||
error: (err: Error) => void;
|
(e: "error"): void;
|
||||||
}
|
};
|
||||||
|
|
||||||
const props = defineProps<TwcWeaponProps>();
|
const props = defineProps<TwcWeaponProps>();
|
||||||
const emits = defineEmits<TwcWeaponEmits>();
|
const emits = defineEmits<TwcWeaponEmits>();
|
||||||
@@ -85,7 +85,7 @@ const selectItems = ref<number[]>([]);
|
|||||||
|
|
||||||
async function loadData(): Promise<void> {
|
async function loadData(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const res = await getWikiData("Weapon", props.item.id);
|
const res = await getWikiData("Weapon", props.item.id.toString());
|
||||||
if (res === undefined) return;
|
if (res === undefined) return;
|
||||||
data.value = res.default;
|
data.value = res.default;
|
||||||
selectItems.value = data.value?.affix.Descriptions.map((item) => item.Level) ?? [];
|
selectItems.value = data.value?.affix.Descriptions.map((item) => item.Level) ?? [];
|
||||||
@@ -94,20 +94,16 @@ async function loadData(): Promise<void> {
|
|||||||
text: `未获取到武器 ${props.item.name} 的 Wiki 数据`,
|
text: `未获取到武器 ${props.item.name} 的 Wiki 数据`,
|
||||||
color: "error",
|
color: "error",
|
||||||
});
|
});
|
||||||
emits("error", error);
|
emits("error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.item,
|
() => props.item,
|
||||||
async () => {
|
async () => await loadData(),
|
||||||
await loadData();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => await loadData());
|
||||||
await loadData();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.tww-box {
|
.tww-box {
|
||||||
|
|||||||
Reference in New Issue
Block a user