fix 修复i18n无感刷新问题
This commit is contained in:
parent
5910032908
commit
4ea7376dbc
@ -14,8 +14,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import SvgIcon from '@/components/SvgIcon/index.vue';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import SvgIcon from '@/components/SvgIcon/index.vue';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const { locale } = useI18n();
|
||||
@ -24,7 +24,7 @@ const message: any = {
|
||||
zh_CN: '切换语言成功!',
|
||||
en_US: 'Switch Language Successful!'
|
||||
};
|
||||
const handleLanguageChange = (lang: string) => {
|
||||
const handleLanguageChange = (lang: any) => {
|
||||
locale.value = lang;
|
||||
appStore.changeLanguage(lang);
|
||||
ElMessage.success(message[lang] || '切换语言成功!');
|
||||
|
@ -18,6 +18,7 @@ export const getLanguage = (): LanguageEnum => {
|
||||
|
||||
const i18n = createI18n({
|
||||
globalInjection: true,
|
||||
allowComposition: true,
|
||||
legacy: false,
|
||||
locale: getLanguage(),
|
||||
messages
|
||||
|
@ -92,11 +92,11 @@ import SearchMenu from './TopBar/search.vue';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import useSettingsStore from '@/store/modules/settings';
|
||||
import useNoticeStore from '@/store/modules/notice';
|
||||
import { getTenantList } from '@/api/login';
|
||||
import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
|
||||
import { TenantVO } from '@/api/types';
|
||||
import notice from './notice/index.vue';
|
||||
import useNoticeStore from '@/store/modules/notice';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const userStore = useUserStore();
|
||||
|
@ -13,8 +13,7 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': path.resolve(__dirname, './'),
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
|
||||
'@': path.resolve(__dirname, './src')
|
||||
},
|
||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user