huang
2025-11-04 1fa4f12a4b218412efeb9f72d4d3ee9e577351b0
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')