From 94e29436087130a45fbb4be1e850cdddeb4da383 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Mon, 5 Jun 2023 19:39:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E5=88=87=E6=8D=A2=E5=88=B0=E8=8B=B1=E6=96=87=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=88=B7=E6=96=B0=E4=BC=9A=E5=9B=9E=E5=88=B0=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/hooks/useTranslationLang.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layout/hooks/useTranslationLang.ts b/src/layout/hooks/useTranslationLang.ts index 9d8374f..ebad161 100644 --- a/src/layout/hooks/useTranslationLang.ts +++ b/src/layout/hooks/useTranslationLang.ts @@ -1,7 +1,7 @@ import { useNav } from "./useNav"; import { useI18n } from "vue-i18n"; import { useRoute } from "vue-router"; -import { watch, type Ref } from "vue"; +import { watch, onBeforeMount, type Ref } from "vue"; export function useTranslationLang(ref?: Ref) { const { $storage, changeTitle, handleResize } = useNav(); @@ -27,6 +27,10 @@ export function useTranslationLang(ref?: Ref) { } ); + onBeforeMount(() => { + locale.value = $storage.locale?.locale ?? "zh"; + }); + return { t, route,