import { createApp } from "vue";
import App from "./App.vue";

// reset style sheet
import "@/styles/reset.scss";

// svg icons
import "virtual:svg-icons-register";
// iconfont css
import "@/assets/iconfont/iconfont.scss";
// element icons
import * as Icons from "@element-plus/icons-vue";
//这个必须引入,解决ElMessageBox失效
import "element-plus/dist/index.css";
//公共样式
import "@/styles/common.scss";
// 重置 element 样式
import "@/styles/element.scss";
// svg icons
import "virtual:svg-icons-register";

// custom directives
import directives from "@/directives/index";
// vue Router
import router from "@/routers";

// pinia store
import pinia from "@/stores";
// errorHandler
import errorHandler from "@/utils/errorHandler";
import VXETable from "vxe-table";
import "vxe-table/lib/style.css";

localStorage.setItem("baseUrl", import.meta.env.VITE_APP_API_BASEURL);

const app = createApp(App);

app.config.errorHandler = errorHandler;
// register the element Icons component
Object.keys(Icons).forEach(key => {
    app.component(key, Icons[key as keyof typeof Icons]);
});

app.use(directives).use(router).use(pinia).use(VXETable).mount("#app");
