import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import * as CustomComponents from '@/components/index.js';
import VirtualKeyboard from 'vue-keyboard-virtual-next';
import svgIcon from './plugin/svg-icon';
import VxeUITable from 'vxe-table';
import 'vxe-table/lib/style.css';
import {
  Button,
  Toast,
  Empty,
  Dialog,
  Calendar,
  Popup,
  Icon,
  Loading,
  Switch,
  RadioGroup,
  Radio,
  CheckboxGroup,
  Checkbox,
} from 'vant';
// 2. 引入组件样式
import 'vant/lib/index.css';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import { registerComponents } from '@/utils/index';
import 'amfe-flexible';
//解决echart的window一体机上无法使用datazoom的问题
import zRenderEnv from 'zrender/lib/core/env';
zRenderEnv.touchEventsSupported = true;
zRenderEnv.pointerEventsSupported = false;
import { createPinia } from 'pinia';
import directives from './directives';
import { createPersistedState } from 'pinia-plugin-persistedstate';
import './assets/css/BaseApp.less';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App);
const pinia = createPinia();
pinia.use(createPersistedState({ storage: sessionStorage }));
const ui_components = [
  router,
  Button,
  Toast,
  Empty,
  Dialog,
  Calendar,
  Popup,
  Switch,
  RadioGroup,
  Radio,
  CheckboxGroup,
  Checkbox,
  Icon,
  Loading,
  CustomComponents,
  svgIcon,
  VxeUITable,
  VirtualKeyboard,
  pinia
];
registerComponents(ui_components, app);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
Object.keys(directives).forEach((key) => {
  app.directive(key, directives[key]);
});
app.use(ElementPlus);
app.mount('#app');
