main.js 1.5 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 App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import "@/common/font/font.css"
  11. import i18n from "@/utils/i18n"
  12. // Vue.use(i18n)
  13. // import '@/icons' // icon
  14. // import '@/permission' // permission control
  15. /**
  16. * If you don't want to use mock-server
  17. * you want to use MockJs for mock api
  18. * you can execute: mockXHR()
  19. *
  20. * Currently MockJs will be used in the production environment,
  21. * please remove it before going online ! ! !
  22. */
  23. // if (process.env.NODE_ENV === 'production') {
  24. // const { mockXHR } = require('../mock')
  25. // mockXHR()
  26. // }
  27. // element 下拉框下拉加载
  28. Vue.directive('loadmore', {
  29. bind(el, binding) {
  30. // 获取element-ui定义好的scroll盒子
  31. const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
  32. SELECTWRAP_DOM.addEventListener('scroll', function () {
  33. const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight
  34. if (CONDITION) {
  35. binding.value()
  36. }
  37. })
  38. }
  39. })
  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. })