From f8958bd65fd0f0de40fb59b48e92a729b9b3f3ad Mon Sep 17 00:00:00 2001 From: jingrow Date: Sat, 3 Jan 2026 21:58:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E7=89=88=20footer=20=E5=92=8C=E8=AF=AD=E8=A8=80=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 英文版 footer 不显示备案信息 - 英文版 footer 显示英文社交图标(Twitter, Facebook, LinkedIn, GitHub) - 中文版 footer 保持原有中文社交图标(微信、微博、抖音、知乎) - 添加动态更新 HTML lang 属性的功能,根据语言切换自动更新 --- src/shared/i18n/index.ts | 8 ++++++++ src/views/HomePage.vue | 44 ++++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/shared/i18n/index.ts b/src/shared/i18n/index.ts index 46af083..14f732b 100644 --- a/src/shared/i18n/index.ts +++ b/src/shared/i18n/index.ts @@ -28,6 +28,10 @@ export function setLocale(code: string) { if (locales.some(l => l.code === code)) { locale.value = code localStorage.setItem('locale', code) + // 动态更新 HTML 的 lang 属性 + if (typeof document !== 'undefined') { + document.documentElement.lang = code + } } } @@ -42,4 +46,8 @@ export function initLocale() { if (saved && locales.some(l => l.code === saved)) { locale.value = saved } + // 初始化时设置 HTML 的 lang 属性 + if (typeof document !== 'undefined') { + document.documentElement.lang = locale.value + } } \ No newline at end of file diff --git a/src/views/HomePage.vue b/src/views/HomePage.vue index 997f2a7..e84671c 100644 --- a/src/views/HomePage.vue +++ b/src/views/HomePage.vue @@ -1199,22 +1199,40 @@ onUnmounted(() => {