main.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 BookUI from 'book-ui';
  10. import 'book-ui/dist/book-ui.css';
  11. Vue.use(BookUI);
  12. import App from './App'
  13. import store from './store'
  14. import router from './router'
  15. import '@/permission' // permission control
  16. // import '@/rem.js'
  17. // 拖拽插件
  18. import VueDND from 'awe-dnd'
  19. Vue.use(VueDND)
  20. // 连线
  21. import jsPlumb from 'jsplumb'
  22. Vue.prototype.$jsPlumb = jsPlumb.jsPlumb
  23. import vcolorpicker from 'vcolorpicker'
  24. Vue.use(vcolorpicker)
  25. import i18n from '@/utils/i18n';
  26. /**
  27. * If you don't want to use mock-server
  28. * you want to use MockJs for mock api
  29. * you can execute: mockXHR()
  30. *
  31. * Currently MockJs will be used in the production environment,
  32. * please remove it before going online ! ! !
  33. */
  34. // set ElementUI lang to EN
  35. // Vue.use(ElementUI, { locale })
  36. // 如果想要中文版 element-ui,按如下方式声明
  37. // element 下拉框下拉加载
  38. Vue.directive('loadmore', {
  39. bind(el, binding) {
  40. // 获取element-ui定义好的scroll盒子
  41. const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
  42. SELECTWRAP_DOM.addEventListener('scroll', function () {
  43. const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight
  44. if (CONDITION) {
  45. binding.value()
  46. }
  47. })
  48. }
  49. })
  50. Vue.use(ElementUI)
  51. // v-select-scroll: Select 组件监听滚动,以便做懒加载
  52. Vue.use(elementUtils)
  53. Vue.config.productionTip = false
  54. new Vue({
  55. el: '#app',
  56. router,
  57. store,
  58. i18n,
  59. render: h => h(App)
  60. })