✏️ add missing await

This commit is contained in:
目棃
2024-07-14 08:40:52 +08:00
parent 704efbb52f
commit e23473862b
5 changed files with 24 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ interface TwgCardProps {
const props = defineProps<TwgCardProps>();
function toWiki(): void {
async function toWiki(): Promise<void> {
if (!props.data.contentId || props.data.contentId === 0) {
showSnackbar({
text: `卡牌 ${props.data.name} 暂无外部链接`,
@@ -27,7 +27,7 @@ function toWiki(): void {
return;
}
const url = Mys.Api.Obc.replace("{contentId}", props.data.contentId.toString());
createTGWindow(
await createTGWindow(
url,
"Sub_window",
`Content_${props.data.contentId} ${props.data.name}`,

View File

@@ -126,7 +126,14 @@ async function toOuter(item?: TGApp.App.Character.WikiBriefInfo): Promise<void>
return;
}
const url = Mys.Api.Obc.replace("{contentId}", item.contentId.toString());
createTGWindow(url, "Sub_window", `Content_${item.contentId} ${item.name}`, 1200, 800, true);
await createTGWindow(
url,
"Sub_window",
`Content_${item.contentId} ${item.name}`,
1200,
800,
true,
);
}
</script>
<style scoped>

View File

@@ -117,7 +117,14 @@ async function toOuter(item?: TGApp.App.Weapon.WikiBriefInfo): Promise<void> {
return;
}
const url = Mys.Api.Obc.replace("{contentId}", item.contentId.toString());
createTGWindow(url, "Sub_window", `Content_${item.contentId} ${item.name}`, 1200, 800, true);
await createTGWindow(
url,
"Sub_window",
`Content_${item.contentId} ${item.name}`,
1200,
800,
true,
);
}
</script>
<style scoped>

View File

@@ -239,12 +239,11 @@ async function switchNews(): Promise<void> {
await router.push("/news/2");
}
function createAnno(item: TGApp.App.Announcement.ListCard): void {
async function createAnno(item: TGApp.App.Announcement.ListCard): Promise<void> {
const annoPath = `/anno_detail/${curRegion.value}/${item.id}/${curLang.value}`;
const annoTitle = `Anno_${item.id} ${item.title}`;
TGLogger.Info(`[Announcements][createAnno][${item.id}] 打开公告窗口`).then(() =>
createTGWindow(annoPath, "Sub_window", annoTitle, 960, 720, false, false),
);
await TGLogger.Info(`[Announcements][createAnno][${item.id}] 打开公告窗口`);
await createTGWindow(annoPath, "Sub_window", annoTitle, 960, 720, false, false);
}
</script>

View File

@@ -88,7 +88,7 @@ onMounted(async () => {
}
// 打开 json
const isDev = useAppStore().devMode ?? false;
if (isDev) createAnnoJson(annoId, region, lang);
if (isDev) await createAnnoJson(annoId, region, lang);
setTimeout(() => {
loading.value = false;
}, 200);
@@ -111,10 +111,10 @@ function parseText(title: string): string {
return div.innerText;
}
function createAnnoJson(annoId: number, region: AnnoServer, lang: AnnoLang) {
async function createAnnoJson(annoId: number, region: AnnoServer, lang: AnnoLang): Promise<void> {
const jsonPath = `/anno_detail_json/${region}/${annoId}/${lang}`;
const jsonTitle = `Anno_${region}_${annoId}_${lang}_JSON`;
createTGWindow(jsonPath, "Dev_JSON", jsonTitle, 960, 720, false, false);
await createTGWindow(jsonPath, "Dev_JSON", jsonTitle, 960, 720, false, false);
}
onUnmounted(() => {