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 element from 'element-ui'
  5. import { sync } from 'vuex-router-sync'
  6. import App from './App'
  7. import i18n from 'libraries/i18n'
  8. import store from 'libraries/store'
  9. import router from 'libraries/router'
  10. import plugins from 'libraries/plugins'
  11. // ## Import styles
  12. // =========================
  13. import 'element-ui/lib/theme-default/index.css'
  14. import 'assets/styles/main.scss'
  15. // ## Use plugins
  16. // =========================
  17. Vue.use(element)
  18. Vue.use(plugins)
  19. sync(store, router, { moduleName: 'route' })
  20. // ## Config
  21. // =========================
  22. Vue.config.debug = process.env.NODE_ENV === 'development'
  23. Vue.config.silent = !Vue.config.debug
  24. Vue.config.devtools = true
  25. Vue.config.productionTip = false
  26. // ## Initial
  27. // =========================
  28. // Element默认不支持 6.x 的 vue-i18n,需要手动处理。
  29. Vue.use(element, {
  30. i18n: key => i18n.vm._t(key)
  31. })
  32. // ## Root app
  33. // =========================
  34. const app = new Vue({
  35. name: 'root',
  36. i18n: i18n,
  37. store: store,
  38. router: router,
  39. render: h => h(App)
  40. })
  41. // ## Mount to `#app` element
  42. // =========================
  43. app.$mount('#app')