main.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { createApp } from 'vue';
  2. import App from './App.vue';
  3. import router from './router';
  4. import store from './store';
  5. import 'font-awesome/css/font-awesome.min.css';
  6. // 引入 element-ui
  7. import ElementPlus from 'element-plus';
  8. import 'element-plus/lib/theme-chalk/index.css';
  9. import locale from 'element-plus/lib/locale/lang/zh-cn';
  10. // 引入环境配置
  11. import "@modeConfig/modeConfig.js";
  12. import "@/lib/global-import.js";
  13. // 引入请求工具
  14. import axios from "@api/axios";
  15. // 引入基础工具
  16. import basicTool from "@tools/basicTool";
  17. /**
  18. * 对 Date 的扩展,将 Date 转化为指定格式的字符串
  19. * @param {String} fmt 传入一个字符串,根据所传字符串的格式返回转换后特定格式的日期,调用姿势:new Date().formatDate("yyyy-MM-dd hh:mm:ss");
  20. */
  21. Date.prototype.formatDate = function (fmt) {
  22. let o = {
  23. "M+": this.getMonth() + 1, //月份
  24. "d+": this.getDate(), //日
  25. "h+": this.getHours(), //小时
  26. "m+": this.getMinutes(), //分
  27. "s+": this.getSeconds(), //秒
  28. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  29. "S": this.getMilliseconds() //毫秒
  30. };
  31. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  32. for (let k in o)
  33. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  34. return fmt;
  35. }
  36. window.__STATICVUE__ = createApp(App);
  37. window.__STATICVUE__.use(ElementPlus, { locale });
  38. window.__STATICVUE__.use(store);
  39. window.__STATICVUE__.use(router);
  40. window.__STATICVUE__.config.globalProperties.API = axios; //全局注册
  41. window.__STATICVUE__.config.globalProperties.BASE = basicTool; //全局注册
  42. window.__STATICVUE__.mount('#app');