fix: 解决刷新之后获取不到 i18n 配置的问题

This commit is contained in:
zhengkunwang223 2023-02-16 11:24:24 +08:00 committed by zhengkunwang223
parent 8074200996
commit 345cc3d955
4 changed files with 4 additions and 4 deletions

View File

@ -23,8 +23,6 @@ const i18nLocale = computed((): any => {
return '';
});
// const assemblySize = computed((): string => globalStore.assemblySize);
let isRouterAlive = ref(true);
const reload = () => {

View File

@ -4,7 +4,7 @@ import en from './modules/en';
const i18n = createI18n({
legacy: false,
locale: 'zh',
locale: localStorage.getItem('lang') || 'zh',
globalInjection: true,
messages: {
zh,

View File

@ -40,6 +40,7 @@ export const GlobalStore = defineStore({
},
updateLanguage(language: any) {
this.language = language;
localStorage.setItem('lang', language);
},
setThemeConfig(themeConfig: ThemeConfigProp) {
this.themeConfig = themeConfig;

View File

@ -166,10 +166,11 @@ import { App } from '@/api/interface/app';
import { ElMessageBox } from 'element-plus';
import { dateFormatSimple } from '@/utils/util';
import { MsgSuccess } from '@/utils/message';
import { useI18n } from 'vue-i18n';
const shortcuts = [
{
text: i18n.global.t('website.ever'),
text: useI18n().t('website.ever'),
value: () => {
return new Date('1970-01-01');
},