初始化
This commit is contained in:
29
src/main.js
Normal file
29
src/main.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import config from '../public/config.js';
|
||||
import axios from './axios'
|
||||
import i18n from './components/i18n.js' // 导入i18n
|
||||
import './assets/main.css'
|
||||
import ElementPlus from 'element-plus'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import 'element-plus/dist/index.css'
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
|
||||
|
||||
const app = createApp(App)
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
// axios挂载到全局属性
|
||||
app.config.globalProperties.$http = axios
|
||||
|
||||
// 提供依赖注入
|
||||
app.provide('config', config)
|
||||
app.provide('$http', axios)
|
||||
|
||||
app.use(router)
|
||||
app.use(ElementPlus, { locale: zhCn })
|
||||
app.use(i18n)
|
||||
app.mount('#app')
|
||||
Reference in New Issue
Block a user