main.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import Vue from 'vue'
  2. import './plugins/request.js'
  3. import App from './App.vue'
  4. import './plugins/element.js'
  5. import router from './router'
  6. import './assets/common.scss'
  7. import querystring from 'querystring';
  8. import hls from 'videojs-contrib-hls'
  9. import store from './store'
  10. import './assets/font/index.scss'
  11. import md5 from 'js-md5';
  12. import Viewer from 'v-viewer' //图片点击放大
  13. import 'viewerjs/dist/viewer.css' //图片点击放大
  14. import utils from "@/util/utils"; // @ 默认的是 src 文件夹,后面省略了utils.js 后面的后缀名js
  15. Vue.use(Viewer);
  16. Vue.prototype.$utils = utils; //直接定义在vue的原型上面
  17. Viewer.setDefaults({
  18. Options: {
  19. 'inline': true,
  20. 'button': true,
  21. 'navbar': true,
  22. 'title': true,
  23. 'toolbar': true,
  24. 'tooltip': true,
  25. 'movable': true,
  26. 'zoomable': true,
  27. 'rotatable': true,
  28. 'scalable': true,
  29. 'transition': true,
  30. 'fullscreen': true,
  31. 'keyboard': true,
  32. 'url': 'data-source'
  33. }
  34. })
  35. Date.prototype.Format = function(fmt) {
  36. let o = {
  37. 'M+': this.getMonth() + 1, // 月份
  38. 'd+': this.getDate(), // 日
  39. 'h+': this.getHours(), // 小时
  40. 'm+': this.getMinutes(), // 分
  41. 's+': this.getSeconds(), // 秒
  42. 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
  43. 'S': this.getMilliseconds() // 毫秒
  44. };
  45. if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)); }
  46. for (let k in o) {
  47. if (new RegExp('(' + k + ')').test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))); }
  48. }
  49. return fmt;
  50. };
  51. Vue.prototype.$md5 = md5;
  52. Vue.config.devtools = true;
  53. // 在main.js文件钟准备一个滚动加载指令
  54. Vue.directive('loadmore', {
  55. bind(el, binding) {
  56. const selectWrap = el.querySelector('.el-table__body-wrapper')
  57. selectWrap.addEventListener('scroll', function() {
  58. let sign = 0
  59. const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight
  60. if (scrollDistance <= sign) {
  61. binding.value()
  62. }
  63. })
  64. }
  65. })
  66. Vue.config.productionTip = false
  67. Vue.prototype.$qs = querystring
  68. Vue.use(hls)
  69. Vue.use(require('vue-wechat-title')) //实例化标题
  70. new Vue({
  71. router,
  72. store,
  73. render: h => h(App)
  74. }).$mount('#app')