import Vue from 'vue' import Cookies from 'js-cookie' import 'normalize.css/normalize.css' import Element from 'element-ui' import 'element-ui/lib/theme-chalk/display.css' import './styles/element-variables.scss' import '@/styles/index.scss' import App from './App' import store from './store' import router from './router' import './icons' import './permission' import './utils/error-log' // 窗口切换检测 import visibility from 'vue-visibility-change' Vue.use(visibility) // 全局过滤器 import * as filters from './filters' // 引入公共方法 import common from './utils/common' Vue.use(common) // 引入vue-UUID组件 import UUID from 'vue-uuid' Vue.use(UUID) // 浮点计算 import calc from './utils/calc' Vue.prototype.$calc = calc // 页面打印 import Print from 'vue-print-nb' Vue.use(Print) // 视频播放 import Video from 'video.js' import 'video.js/dist/video-js.css' Vue.prototype.$video = Video // UI默认尺寸 Vue.use(Element, { size: Cookies.get('size') || 'medium' }) // 全局过滤器 Object.keys(filters).forEach(key => { Vue.filter(key, filters[key]) }) // 禁止右键指令 Vue.directive('preventright', { bind: function (el, binding, vnode) { el.oncontextmenu = function () { return false } } }) Vue.config.productionTip = false /** * 对 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; } new Vue({ el: '#app', router, store, render: h => h(App) })