import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "font-awesome/css/font-awesome.min.css";


// 引入 element-ui
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
// import "element-plus/lib/theme-chalk/index.css";
import locale from "element-plus/lib/locale/lang/zh-cn";

// // 引入环境配置
// import "@modeConfig/modeConfig.js";

import "@/lib/global-import.js";

// 引入请求工具
import axios from "@api/axios";

// 引入基础工具
import basicTool from "@tools/basicTool";

import animated from "animate.css";

/**
 * 对 Date 的扩展，将 Date 转化为指定格式的字符串
 * @param {String} fmt 传入一个字符串，根据所传字符串的格式返回转换后特定格式的日期。
 * 调用姿势：new Date().formatDate("yyyy-MM-dd hh:mm:ss");
 */
Date.prototype.formatDate = function (fmt) {
  let o = {
    "M+": this.getMonth() + 1, //月份 
    "d+": this.getDate(), //日 
    "h+": this.getHours(), //小时 
    "m+": this.getMinutes(), //分 
    "s+": this.getSeconds(), //秒 
    "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
    "S": this.getMilliseconds() //毫秒 
  };
  if (/(y+)/.test(fmt)) {
    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  }
  for (let k in o) {
    if (new RegExp("(" + k + ")").test(fmt)) {
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    }

  }
  return fmt;
}

window.__STATICVUE__ = createApp(App);
window.__STATICVUE__.use(ElementPlus, { locale });
window.__STATICVUE__.use(store);
window.__STATICVUE__.use(router);
window.__STATICVUE__.use(animated);

window.__STATICVUE__.config.globalProperties.API = axios; //全局注册
window.__STATICVUE__.config.globalProperties.BASE = basicTool; //全局注册

// window.__STATICVUE__.config.globalProperties.$Cesium = Cesium;

window.__STATICVUE__.mount('#app');