From 1fa4f12a4b218412efeb9f72d4d3ee9e577351b0 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期二, 04 十一月 2025 08:27:24 +0800
Subject: [PATCH] 修改仓储出库方法,添加i18n可配置文件

---
 UI-Project/src/main.js |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/UI-Project/src/main.js b/UI-Project/src/main.js
index 8cc37d3..fb045af 100644
--- a/UI-Project/src/main.js
+++ b/UI-Project/src/main.js
@@ -6,10 +6,11 @@
 import router from './router'
 import ElementPlus from 'element-plus'
 import 'element-plus/dist/index.css'
-import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
 import VXETable from 'vxe-table'
 import 'vxe-table/lib/style.css'
-import i18n, { syncElementLocale } from '@/lang'; 
+import zhLocale from 'element-plus/dist/locale/zh-cn.mjs';
+import enLocale from 'element-plus/dist/locale/en.mjs';
+import i18n ,{syncElementLocale} from '@/lang'; 
 // import Echarts from "vue-echarts"
 // echarts.registerMap('china', china)
 // Vue.prototype.$echarts = echarts
@@ -21,15 +22,22 @@
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
   app.component(key, component)
 }
+const initElementLocale = () => {
+  const currentLang = i18n.global.locale.value;
+  return currentLang === 'zh' ? zhLocale : enLocale;
+};
+
+// 浼犲叆鍒濆璇█鍖�
+app.use(ElementPlus, {
+  locale: initElementLocale()
+})
+
 const pinia = createPinia()
 pinia.use(piniaPluginPersistedstate )
 app.use(VXETable)
 app.use(pinia)
 app.use(router)
 app.use(ElementPlus)
-// app.use(ElementPlus,{
-//     locale: zhCn,
-// })
 app.use(i18n)
 syncElementLocale(); 
 app.mount('#app')
\ No newline at end of file

--
Gitblit v1.8.0