2021-06-07 17:22:07 +08:00
|
|
|
|
import { createApp } from 'vue';
|
|
|
|
|
|
import App from './App.vue';
|
|
|
|
|
|
import router from './router';
|
|
|
|
|
|
import { store, key } from './store';
|
|
|
|
|
|
import { directive } from '@/common/utils/directive.ts';
|
|
|
|
|
|
import { globalComponentSize } from '@/common/utils/componentSize.ts';
|
|
|
|
|
|
import { dateStrFormat } from '@/common/utils/date.ts'
|
|
|
|
|
|
|
|
|
|
|
|
import ElementPlus from 'element-plus';
|
2022-01-12 16:00:31 +08:00
|
|
|
|
import 'element-plus/dist/index.css';
|
2022-03-15 22:27:39 +08:00
|
|
|
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
2021-06-07 17:22:07 +08:00
|
|
|
|
import '@/theme/index.scss';
|
|
|
|
|
|
import mitt from 'mitt';
|
|
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
2022-01-12 16:00:31 +08:00
|
|
|
|
import * as svg from '@element-plus/icons-vue';
|
|
|
|
|
|
import SvgIcon from '@/components/svgIcon/index.vue';
|
2022-01-28 11:30:11 +08:00
|
|
|
|
import '@/assets/font/font.css'
|
2022-01-12 16:00:31 +08:00
|
|
|
|
|
2021-06-07 17:22:07 +08:00
|
|
|
|
const app = createApp(App);
|
2023-02-13 21:11:16 +08:00
|
|
|
|
// 屏蔽警告信息
|
|
|
|
|
|
app.config.warnHandler = () => null;
|
2021-06-07 17:22:07 +08:00
|
|
|
|
|
2022-01-12 16:00:31 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 导出全局注册 element plus svg 图标
|
|
|
|
|
|
* @param app vue 实例
|
|
|
|
|
|
* @description 使用:https://element-plus.gitee.io/zh-CN/component/icon.html
|
|
|
|
|
|
*/
|
|
|
|
|
|
function elSvg(app: any) {
|
|
|
|
|
|
const icons = svg as any;
|
|
|
|
|
|
for (const i in icons) {
|
|
|
|
|
|
app.component(`${icons[i].name}`, icons[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
app.component('SvgIcon', SvgIcon);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-28 11:30:11 +08:00
|
|
|
|
elSvg(app);
|
2022-01-12 16:00:31 +08:00
|
|
|
|
directive(app);
|
|
|
|
|
|
|
2021-06-07 17:22:07 +08:00
|
|
|
|
app.use(router)
|
|
|
|
|
|
.use(store, key)
|
2022-03-15 22:27:39 +08:00
|
|
|
|
.use(ElementPlus, { size: globalComponentSize, locale: zhCn})
|
2021-06-07 17:22:07 +08:00
|
|
|
|
.mount('#app');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 自定义全局过滤器
|
|
|
|
|
|
app.config.globalProperties.$filters = {
|
|
|
|
|
|
dateFormat(value: any) {
|
|
|
|
|
|
if (!value) {
|
|
|
|
|
|
return ""
|
|
|
|
|
|
}
|
|
|
|
|
|
return dateStrFormat('yyyy-MM-dd HH:mm:ss', value)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 全局error处理
|
|
|
|
|
|
app.config.errorHandler = function (err: any, vm, info) {
|
|
|
|
|
|
// 如果是断言错误,则进行提示即可
|
|
|
|
|
|
if (err.name == 'AssertError') {
|
|
|
|
|
|
ElMessage.error(err.message)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.error(err, info)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
app.config.globalProperties.mittBus = mitt();
|