123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- 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 * as ElementPlusIconsVue from "@element-plus/icons-vue";
- // // 引入环境配置
- // import "@modeConfig/modeConfig.js";
- import "@/lib/global-import.js";
- import "./permission";
- // 引入请求工具
- import axios from "@api/axios";
- // 引入基础工具
- import basicTool from "@tools/basicTool";
- import animated from "animate.css";
- import { ElMessage } from "element-plus";
- const app = createApp(App);
- /**阻止多次重复点击指令 延时暂定5秒 示例 v-prevdbclick:arg='func' */
- const messageToast = () => {
- //作为eventListener时, 必须使用外部定义函数
- ElMessage.error("5秒内请勿重复点击");
- };
- const funListener = (el, binding) => {
- let time = null;
- el.removeEventListener("click", messageToast);
- el.addEventListener(
- "click",
- () => {
- binding.value();
- el.addEventListener("click", messageToast, false);
- time = setTimeout(() => {
- clearTimeout(time);
- funListener(el, binding);
- }, Number(binding.arg) || 5000);
- },
- {
- once: true,
- }
- );
- };
- /**
- * 对 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;
- };
- app.directive("prevdbclick", {
- mounted(el, binding) {
- funListener(el, binding);
- },
- });
- for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
- app.component(key, component);
- }
- window.__STATICVUE__ = app;
- window.__STATICVUE__.use(ElementPlus, { locale });
- // 全局修改默认配置,点击空白处不能关闭弹窗
- app._context.components.ElDialog["props"].closeOnClickModal.default = false;
- 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");
|