main.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import 'normalize.css/normalize.css' // a modern alternative to CSS resets
  4. import Element from 'element-ui'
  5. import './styles/element-variables.scss'
  6. import '@/styles/index.scss' // global css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import i18n from './lang' // internationalization
  11. import './icons' // icon
  12. import './permission' // permission control
  13. import './utils/error-log' // error log
  14. import * as filters from './filters' // global filters
  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. Vue.prototype.$fixModalZIndex = function() {
  28. this.$nextTick(() => {
  29. const modals = document.querySelectorAll('.v-modal');
  30. modals.forEach(modal => {
  31. if (parseInt(modal.style.zIndex, 10) > 10999) {
  32. modal.style.zIndex = 10999;
  33. }
  34. });
  35. });
  36. };
  37. Vue.use(Element, {
  38. size: Cookies.get('size') || 'medium', // set element-ui default size
  39. i18n: (key, value) => i18n.t(key, value)
  40. })
  41. // register global utility filters
  42. Object.keys(filters).forEach(key => {
  43. Vue.filter(key, filters[key])
  44. })
  45. Vue.config.productionTip = false
  46. new Vue({
  47. el: '#app',
  48. router,
  49. store,
  50. i18n,
  51. render: h => h(App)
  52. })