123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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 'windi.css'
- // 引入element 自定义css
- import 'element-plus/dist/index.css'
- import "./element-theme/index.scss";
- import locale from "element-plus/lib/locale/lang/zh-cn";
- import * as ElementPlusIconsVue from '@element-plus/icons-vue'
- import axios from 'axios'
- //引入字体
- import '../public/css/font.css'
- import { ElMessage } from 'element-plus'
- import './permission'
- 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.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)
- }
- app.config.globalProperties.$axios = axios;
- window.__STATICVUE__ = app;
- window.__STATICVUE__.use(ElementPlus, {
- locale
- });
- window.__STATICVUE__.use(store);
- window.__STATICVUE__.use(router);
- window.__STATICVUE__.mount('#app');
|