main.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import Vue from 'vue'
  2. import 'normalize.css/normalize.css' // A modern alternative to CSS resets
  3. import '@/common/font/font.css'
  4. import ElementUI from 'element-ui'
  5. import 'element-ui/lib/theme-chalk/index.css'
  6. import locale from 'element-ui/lib/locale/lang/en' // lang i18n
  7. import elementUtils from 'vue-element-utils'
  8. import '@/styles/index.scss' // global css
  9. import App from './App'
  10. import store from './store'
  11. import router from './router'
  12. import '@/permission' // permission control
  13. import i18n from '@/utils/i18n';
  14. import '@/icons' // icon
  15. import global from "@/store/global" // 全局常量
  16. Vue.use(global);
  17. // import '@/rem.js'
  18. // 拖拽插件
  19. import VueDND from 'awe-dnd'
  20. Vue.use(VueDND)
  21. // import VideoPlayer from 'vue-video-player'
  22. // require('video.js/dist/video-js.css')
  23. // require('vue-video-player/src/custom-theme.css')
  24. // Vue.use(VideoPlayer)
  25. /**
  26. * If you don't want to use mock-server
  27. * you want to use MockJs for mock api
  28. * you can execute: mockXHR()
  29. *
  30. * Currently MockJs will be used in the production environment,
  31. * please remove it before going online ! ! !
  32. */
  33. // set ElementUI lang to EN
  34. // Vue.use(ElementUI, { locale })
  35. // 如果想要中文版 element-ui,按如下方式声明
  36. // element 下拉框下拉加载
  37. Vue.directive('loadmore', {
  38. bind(el, binding) {
  39. // 获取element-ui定义好的scroll盒子
  40. const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
  41. SELECTWRAP_DOM.addEventListener('scroll', function() {
  42. const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight
  43. if (CONDITION) {
  44. binding.value()
  45. }
  46. })
  47. }
  48. })
  49. Vue.use(ElementUI)
  50. // v-select-scroll: Select 组件监听滚动,以便做懒加载
  51. Vue.use(elementUtils)
  52. Vue.config.productionTip = false
  53. new Vue({
  54. el: '#app',
  55. router,
  56. store,
  57. i18n,
  58. render: h => h(App)
  59. })