import Vue from 'vue' import './plugins/request.js' import App from './App.vue' import './plugins/element.js' import router from './router' import './assets/common.scss' import querystring from 'querystring'; import hls from 'videojs-contrib-hls' import store from './store' import './assets/font/index.scss' import md5 from 'js-md5'; import Viewer from 'v-viewer' //图片点击放大 import 'viewerjs/dist/viewer.css' //图片点击放大 import utils from "@/util/utils"; // @ 默认的是 src 文件夹,后面省略了utils.js 后面的后缀名js Vue.use(Viewer); Vue.prototype.$utils = utils; //直接定义在vue的原型上面 Viewer.setDefaults({ Options: { 'inline': true, 'button': true, 'navbar': true, 'title': true, 'toolbar': true, 'tooltip': true, 'movable': true, 'zoomable': true, 'rotatable': true, 'scalable': true, 'transition': true, 'fullscreen': true, 'keyboard': true, 'url': 'data-source' } }) Date.prototype.Format = 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; }; Vue.prototype.$md5 = md5; Vue.config.devtools = true; // 在main.js文件钟准备一个滚动加载指令 Vue.directive('loadmore', { bind(el, binding) { const selectWrap = el.querySelector('.el-table__body-wrapper') selectWrap.addEventListener('scroll', function() { let sign = 0 const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight if (scrollDistance <= sign) { binding.value() } }) } }) Vue.config.productionTip = false Vue.prototype.$qs = querystring Vue.use(hls) Vue.use(require('vue-wechat-title')) //实例化标题 new Vue({ router, store, render: h => h(App) }).$mount('#app')