main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 'element-ui/lib/theme-chalk/index.css'
  6. import App from './App'
  7. import router from './router'
  8. // import axios from 'axios'
  9. import axios from './utils/axiosPlugin'
  10. import errorInfo from './utils/errorCode'
  11. import webSocketService from './utils/websocket';
  12. import './utils/loginTimeOut'; // 增加的超时登录退出的js
  13. Vue.use(ElementUI)
  14. Vue.prototype.$webSocket = webSocketService;
  15. Vue.config.productionTip = false
  16. Vue.prototype.$axios = axios
  17. Vue.directive('clickoutside', {
  18. bind (el, binding, vnode) {
  19. function documentHandler (e) {
  20. if (el.contains(e.target)) {
  21. return false
  22. }
  23. if (binding.expression) {
  24. binding.value(e)
  25. }
  26. }
  27. el.__vueClickOutside__ = documentHandler
  28. document.addEventListener('click', documentHandler)
  29. },
  30. unbind (el, binding) {
  31. document.removeEventListener('click', el.__vueClickOutside__)
  32. delete el.__vueClickOutside__
  33. }
  34. })
  35. /* eslint-disable no-new */
  36. const appVue = new Vue({
  37. el: '#app',
  38. render: h => h(App),
  39. router,
  40. components: {App},
  41. template: '<App/>'
  42. })