main_20210531172949.js 1.6 KB

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