Commit b653412260ad5c01e20727ac351ee54068f5e069
Committed by
GitHub
1 parent
a530ec86
fixed: (update pageTitle when change local) (#1278)
If AppLocalePicker reload prop is false, Should be updated when changing the language
Showing
1 changed file
with
3 additions
and
1 deletions
src/hooks/web/useTitle.ts
@@ -3,6 +3,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; | @@ -3,6 +3,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; | ||
3 | import { useTitle as usePageTitle } from '@vueuse/core'; | 3 | import { useTitle as usePageTitle } from '@vueuse/core'; |
4 | import { useGlobSetting } from '/@/hooks/setting'; | 4 | import { useGlobSetting } from '/@/hooks/setting'; |
5 | import { useRouter } from 'vue-router'; | 5 | import { useRouter } from 'vue-router'; |
6 | +import { useLocaleStore } from '/@/store/modules/locale'; | ||
6 | 7 | ||
7 | import { REDIRECT_NAME } from '/@/router/constant'; | 8 | import { REDIRECT_NAME } from '/@/router/constant'; |
8 | 9 | ||
@@ -13,11 +14,12 @@ export function useTitle() { | @@ -13,11 +14,12 @@ export function useTitle() { | ||
13 | const { title } = useGlobSetting(); | 14 | const { title } = useGlobSetting(); |
14 | const { t } = useI18n(); | 15 | const { t } = useI18n(); |
15 | const { currentRoute } = useRouter(); | 16 | const { currentRoute } = useRouter(); |
17 | + const localeStore = useLocaleStore(); | ||
16 | 18 | ||
17 | const pageTitle = usePageTitle(); | 19 | const pageTitle = usePageTitle(); |
18 | 20 | ||
19 | watch( | 21 | watch( |
20 | - () => currentRoute.value.path, | 22 | + [() => currentRoute.value.path, () => localeStore.getLocale], |
21 | () => { | 23 | () => { |
22 | const route = unref(currentRoute); | 24 | const route = unref(currentRoute); |
23 | 25 |