import "amfe-flexible";
import { createApp } from "vue";
import VConsole from "vconsole";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/css/reset.css";
import "vant/es/dialog/style";
import "vant/es/toast/style";
import "vant/es/image-preview/style";
import VueHashCalendar from "vue3-hash-calendar";
import "vue3-hash-calendar/es/index.css";
import { liveStatusObj } from "@/config/constant";
import shieldConfig from "@/config/index";
import { getProductType, dateFormat, getPrice } from "@/utils/filters";
import SvgIcon from "@/components/SvgIcon";
// import { terminalType } from "@/utils/index";
// import loadScript from "@/utils/loadScript";

if (window.config.VConsole) {
  new VConsole();
}
const app = createApp(App);

// 自定义指令
import * as directive from "@/directive";

Object.keys(directive).forEach((key) => {
  app.directive(key, directive[key]);
});

const init = () => {
  app.use(store);
  app.use(router);
  app.use(VueHashCalendar);
  app.config.globalProperties.$liveStatusObj = liveStatusObj;
  app.config.globalProperties.$shieldConfig = shieldConfig;
  app.config.globalProperties.$filters = {
    getProductType,
    dateFormat,
    getPrice,
  };

  app.component("svg-icon", SvgIcon);
  app.mount("#app");
};
init();
