main.js 1.9 KB

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