main.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // The Vue build version to load with the `import` command
  2. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
  3. import Vue from 'vue'
  4. import ElementUI from 'element-ui'
  5. import locale from 'element-ui/lib/locale/lang/en'
  6. import 'element-ui/lib/theme-chalk/index.css'
  7. import App from './App'
  8. import router from './router'
  9. // import axios from 'axios'
  10. import axios from './utils/axiosPlugin'
  11. import errorInfo from './utils/errorCode'
  12. Vue.use(ElementUI,{locale})
  13. Vue.config.productionTip = false
  14. Vue.prototype.$axios = axios
  15. Vue.directive('clickoutside', {
  16. bind (el, binding, vnode) {
  17. function documentHandler (e) {
  18. if (el.contains(e.target)) {
  19. return false
  20. }
  21. if (binding.expression) {
  22. binding.value(e)
  23. }
  24. }
  25. el.__vueClickOutside__ = documentHandler
  26. document.addEventListener('click', documentHandler)
  27. },
  28. unbind (el, binding) {
  29. document.removeEventListener('click', el.__vueClickOutside__)
  30. delete el.__vueClickOutside__
  31. }
  32. })
  33. /* eslint-disable no-new */
  34. const appVue = new Vue({
  35. el: '#app',
  36. render: h => h(App),
  37. router,
  38. components: {App},
  39. template: '<App/>'
  40. })