main.js 1.6 KB

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