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,