兰宝车间质量管理系统-前端
LiuHao
2024-01-11 4ea7376dbc32374c03e60c131b5ce728762cff6b
fix 修复i18n无感刷新问题
已修改4个文件
10 ■■■■ 文件已修改
src/components/LangSelect/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/lang/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Navbar.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LangSelect/index.vue
@@ -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 @@
  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] || '切换语言成功!');
src/lang/index.ts
@@ -18,6 +18,7 @@
const i18n = createI18n({
  globalInjection: true,
  allowComposition: true,
  legacy: false,
  locale: getLanguage(),
  messages
src/layout/components/Navbar.vue
@@ -92,11 +92,11 @@
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();
vite.config.ts
@@ -13,8 +13,7 @@
    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']
    },