feat: 设置语言时同时设置HTML lang

This commit is contained in:
TsMask
2023-12-28 09:25:03 +08:00
parent 24816eb991
commit 9c61026c88
2 changed files with 5 additions and 4 deletions

View File

@@ -31,11 +31,12 @@ export default function useLocale() {
}, },
]; ];
// 挂载前根据默认语言设置一次 // 挂载前根据默认语言设置一次
onBeforeMount(() => { onBeforeMount(() => {
const localI18n = localGet(CACHE_LOCAL_I18N); const localI18n = localGet(CACHE_LOCAL_I18N);
if (localI18n) { if (localI18n) {
i18n.locale.value = localI18n; i18n.locale.value = localI18n;
document.documentElement.lang = localI18n.replace('_', '-');
} }
}); });

View File

@@ -15,10 +15,10 @@ type AppStore = {
appVersion: string; appVersion: string;
/**服务版本 */ /**服务版本 */
version: string, version: string;
buildTime: string, buildTime: string;
// 序列号 // 序列号
serialNum: string, serialNum: string;
/**应用版权声明 */ /**应用版权声明 */
copyright: string; copyright: string;
/**LOGO显示类型 */ /**LOGO显示类型 */