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 } from 'vant';
// 2. 引入组件样式
import 'vant/lib/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 ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import { createPersistedState } from 'pinia-plugin-persistedstate';
const app = createApp(App);
const pinia = createPinia();
pinia.use(createPersistedState({ storage: sessionStorage }));
const ui_components = [
  router,
  Button,
  Toast,
  Empty,
  Dialog,
  Calendar,
  Popup,
  Icon,
  Loading,
  CustomComponents,
  svgIcon,
  VxeUITable,
  VirtualKeyboard,
  pinia
];
app.use(ElementPlus);
registerComponents(ui_components, app);
Object.keys(directives).forEach((key) => {
  app.directive(key, directives[key]);
});
app.mount('#app');
