main.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // 引入字体样式
  11. import '@/assets/common/fonts/font.css';
  12. import '@/assets/common/js/flexible.js';
  13. import getPageTitle from '@/utils/get-page-title'
  14. import '@/icons' // icon
  15. import '@/permission' // permission control
  16. /* 路由发生变化修改页面title */
  17. router.beforeEach((to, from, next) => {
  18. if (to.meta.title) {
  19. document.title = getPageTitle(to.meta.title)
  20. }
  21. next()
  22. })
  23. /**
  24. * If you don't want to use mock-server
  25. * you want to use MockJs for mock api
  26. * you can execute: mockXHR()
  27. *
  28. * Currently MockJs will be used in the production environment,
  29. * please remove it before going online ! ! !
  30. */
  31. if (process.env.NODE_ENV === 'production') {
  32. const { mockXHR } = require('../mock')
  33. mockXHR()
  34. }
  35. // set ElementUI lang to EN
  36. // Vue.use(ElementUI, { locale })
  37. // 如果想要中文版 element-ui,按如下方式声明
  38. Vue.use(ElementUI)
  39. Vue.config.productionTip = false
  40. new Vue({
  41. el: '#app',
  42. router,
  43. store,
  44. render: h => h(App)
  45. })
  46. // Vue.http.options.emulateJSON = true;
  47. // Vue.http.options.headers = {
  48. // 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
  49. // };