main.ts
1.32 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
45
46
47
48
import { createApp } from 'vue'
import App from './App.vue'
import router from '@/router/index'
import promise from 'es6-promise'
// import store from '@/store/index'
import ElementPlus from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn' // TIP elementUI配置中文环境
import '@/utils/progress'
import '@/style/reset.scss'
import * as globalVariable from '@/utils/variable'
// TIP store 管理,含存数据到本地缓存
import pinia from '@/pinia'
// import { createPinia } from 'pinia'
// import { createPersistedState } from 'pinia-persistedstate-plugin'
// const pinia = createPinia()
// pinia.use(createPersistedState({}))
promise.polyfill()
console.log('current env: ', process.env.NODE_ENV)
console.log('current api url: ', import.meta.env.VITE_BASE_URL)
const app = createApp(App)
// TIP 全局静态变量、方法挂载
for(const i in globalVariable) {
app.config.globalProperties[i] = globalVariable[i]
}
// TIP 关浏览器控制台错误和警告
// app.config.warnHandler = () => null;
// app.config.errorHandler = () => null;
app.provide("$message", ElMessage);
app.provide("$messageBox", ElMessageBox );
app
// .use(store)
.use(router)
.use(pinia)
.use(ElementPlus, {
locale: zhCn,
})
.mount('#app')