You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

77 lines
2.0 KiB

import {createApp} from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
// import zhCn from 'element-plus/es/locale/lang/zh-cn'
// import en from 'element-plus/es/locale/lang/en'
// import th from 'element-plus/es/locale/lang/th'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './assets/css/common.css' // 引入公共CSS文件
import JsonExcel from 'vue-json-excel'
import {createPinia} from 'pinia'
import VxeUI from 'vxe-pc-ui'
import 'vxe-pc-ui/lib/style.css'
import VxeUITable from 'vxe-table'
import 'vxe-table/lib/style.css'
// 修正导入路径
import {useAdminStore} from './store'
import request from "@/util/request";
import "./global.css";
import '@/assets/css/btn.css';
import {useMessageStore} from "@/store";
import i18n from './components/locales'
const app = createApp(App)
const pinia = createPinia()
// 全局注册 ElementPlus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
// 先注册组件再挂载
app.component('downloadExcel', JsonExcel)
app.config.globalProperties.$http = request
// // 动态设置 Element Plus 的语言
// const getElementPlusLocale = () => {
// const lang = localStorage.getItem('lang') || 'zh-CN'
// switch (lang) {
// case 'en':
// return en
// case 'th':
// return th
// case 'zh-CN':
// default:
// return zhCn
// }
// }
// 使用各种插件
app.use(ElementPlus)
.use(router)
.use(VxeUI)
.use(VxeUITable)
.use(pinia)
.use(i18n)
.mount('#app')
// 在 app 挂载之后再使用 store
const adminStore = useAdminStore()
const messageStore = useMessageStore()
adminStore.initFromLocalStorage()
messageStore.initFromLocalStorage()
// 初始化语言设置
const initLanguage = () => {
const lang = localStorage.getItem('lang')
if (!lang) {
// 如果没有设置语言,默认使用中文
localStorage.setItem('lang', 'zh-CN')
}
}
initLanguage()