import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import { store, key } from './store';
import { directive } from '/@/utils/directive';
import { i18n } from '/@/i18n/index';
import other from '/@/utils/other';

import ElementPlus from 'element-plus';
import * as ElIconModules from "@element-plus/icons";

import 'element-plus/dist/index.css';
import $ from 'jquery';
import '/@/theme/index.scss';
import '/@/assets/index.scss'; //src/assets/datestyle.less src/assets/index.scss
import svgIconTr from './components/svgIconTr.vue'
// import '/@/assets/iconfonts/iconfont.css'

const iconfontScript = document.createElement('script')
iconfontScript.src = '//at.alicdn.com/t/c/font_4977343_ok0mmbwb5ag.js'
document.body.appendChild(iconfontScript)

import mitt from 'mitt';

import screenShort from 'vue-web-screen-shot';
import VueGridLayout from 'vue-grid-layout';
import eventBus from 'vue3-eventbus';
import print from 'vue3-print-nb'
//import 'default-passive-events'
import installDirective from './directives';

import zhCn from 'element-plus/es/locale/lang/zh-cn';
import 'dayjs/locale/zh-cn';

const app = createApp(App);

directive(app);
other.elSvg(app); 
//加载自定义的svg载入组件
 
app
	.use(print)
	.use(eventBus)
	.use(router)
	.use(store, key)
	.use(ElementPlus, { i18n: i18n.global.t, size: other.globalComponentSize, locale: zhCn})
	.use(i18n)
	.use(screenShort, { enableWebRtc: false })
	.use(VueGridLayout)
	.use($)
	.component('svg-icon-tr', svgIconTr)//加载自定义的svg载入组件
	.mount('#app');

app.config.globalProperties.mittBus = mitt();

installDirective(app);
//动态注册全局elment-plus/icons 主要用svg 废弃fontico
for (const iconName in ElIconModules) {
	app.component(iconName, ElIconModules[iconName as keyof typeof ElIconModules])
}
