diff --git a/src/components/home/t-calendar-birth.vue b/src/components/home/t-calendar-birth.vue index 0ba2a317..5242323b 100644 --- a/src/components/home/t-calendar-birth.vue +++ b/src/components/home/t-calendar-birth.vue @@ -49,7 +49,7 @@ onBeforeMount(async () => { next.value = TSAvatarBirth.getNextAvatarBirth(); }); -function toBirth(type: TGApp.Archive.Birth.RoleItem | true) { +function toBirth(type: TGApp.Archive.Birth.RoleItem) { let dateStr; if (type === true) { const date = new Date(); @@ -59,7 +59,7 @@ function toBirth(type: TGApp.Archive.Birth.RoleItem | true) { } else { dateStr = type.role_birthday; } - if (type != true) { + if (type !== true) { router.push({ name: "留影叙佳期", params: { date: dateStr } }); return; } @@ -72,20 +72,23 @@ function toBirth(type: TGApp.Archive.Birth.RoleItem | true) { } function parseDesc(intro: string): string { - const dom = document.createElement("div"); - dom.innerHTML = intro; - return dom.innerText; + const dom = new DOMParser().parseFromString(intro, "text/html"); + return dom.body.textContent || ""; } diff --git a/tsconfig.json b/tsconfig.json index 4aeaaad0..2d35cc3f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "esModuleInterop": true, "lib": ["DOM", "ESNext"], "skipLibCheck": true, - "types": ["vite/client", "node", "color-convert", "js-md5", "uuid"], + "types": ["vite/client", "node", "color-convert", "js-md5", "uuid", "src/vite-env"], "allowSyntheticDefaultImports": true, "composite": true },