import { createApp } from 'vue';
import pinia from '@/stores/index';
import App from './App.vue';
import router from './router';
import { directive } from '@/directive';
import other from '@/utils/other';
//  引入element
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import '@/theme/index.scss';
// 表格组件
import ProTable from '@/components/ProTable/index.vue';

import { VxeUI, VxeButton, VxeIcon, VxeModal, VxeLoading, VxeTooltip, VxeNumberInput, VxeRadioGroup, VxeTip } from 'vxe-pc-ui';

import { VxeTable, VxeColumn, VxeToolbar, VxeGrid, VxeColgroup } from 'vxe-table';

// 导入主题变量，也可以重写主题变量
import 'vxe-table/styles/cssvar.scss';
import 'vxe-pc-ui/styles/cssvar.scss';
// 虚拟数的css
import '@wsfe/vue-tree/style.css';

// 导入默认的语言
import zhCN from 'vxe-pc-ui/lib/language/zh-CN';

VxeUI.setI18n('zh-CN', zhCN);
VxeUI.setLanguage('zh-CN');

function lazyVxeUI(app: any) {
	app.use(VxeButton);
	app.use(VxeIcon);
	app.use(VxeModal);
	app.use(VxeLoading);
	app.use(VxeTooltip);
	app.use(VxeNumberInput);
	app.use(VxeRadioGroup);
	app.use(VxeTip);
}

function lazyVxeTable(app: any) {
	app.use(VxeTable);
	app.use(VxeColumn);
	app.use(VxeColgroup);
	app.use(VxeGrid);
	app.use(VxeToolbar);
}

// 注册echarts
import { registerEcharts } from '@/utils/echarts';
const app = createApp(App);

// 自定义指令和svg组件
directive(app);
other.elSvg(app);
// 全局组件挂载
app.component('ProTable', ProTable);
registerEcharts(app);

app.use(pinia).use(router).use(ElementPlus).use(lazyVxeUI).use(lazyVxeTable).mount('#app');
