zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import './assets/main.css'
 
import {createApp} from 'vue'
import App from './App.vue'
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 axios from "axios";
 
async function init() {
    await getServerConfig()
}
 
const app = createApp(App)
 
app.use(init)
export const globals = app.config.globalProperties
 
app.use(router)
app.use(ElementPlus, {
    locale: zhCn,
})
app.mount('#app')
 
function getServerConfig() {
    return new Promise((resolve, reject) => {
        axios.get('/config.json').then(res => {
            app.config.globalProperties.$config = res.data;
            resolve();
        }).catch(error => {
            console.log(error);
            reject()
        })
    })
}