main.ts
1.29 KB
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
37
38
39
40
41
42
43
44
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2023-09-04 11:36:12
*/
import { createApp } from 'vue'
import store from './store'
// import apis from './api/index'
import router, { setupRouter } from './router'
import App from './App.vue'
import fetchConfig from './utils/config'
import fetchConfig1 from './utils/config1'
import VConsole from 'vconsole'
import 'assets/styles/common.scss'
const app = createApp(App)
let vConsole: object = {}
import { components } from './libs/vant'
components.forEach(component => app.use(component));
// 自动注册全局组件
const modules = import.meta.globEager('./components/**/index.ts')
for (const path in modules) {
app.use(modules[path].default)
}
fetchConfig().then(res => {
app.provide('global', {
$imgUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/h5-posters/',
version: res.version,
baseUrl: res.otherRequest.baseURL
})
localStorage.setItem('config', JSON.stringify(res))
fetchConfig1().then(result => {
localStorage.setItem('config1', JSON.stringify(result))
app.use(store)
setupRouter(app)
router.isReady().then(() => {
app.mount('#app')
})
})
// if (res.vconsole) vConsole = new VConsole()
})