main.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import Vue from 'vue'
  2. import App from '@/App'
  3. import router from '@/router' // api: https://github.com/vuejs/vue-router
  4. import store from '@/store' // api: https://github.com/vuejs/vuex
  5. import VueCookie from 'vue-cookie' // api: https://github.com/alfhen/vue-cookie
  6. import '@/element-ui' // api: https://github.com/ElemeFE/element
  7. import '@/icons' // api: http://www.iconfont.cn/
  8. import '@/element-ui-theme'
  9. import '@/assets/scss/index.scss'
  10. import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
  11. import { isAuth } from '@/utils'
  12. import cloneDeep from 'lodash/cloneDeep'
  13. import ElementUI from 'element-ui'
  14. import 'element-ui/lib/theme-chalk/index.css'
  15. import { Message, MessageBox } from 'element-ui'
  16. import '../src/assets/datasetImg/ico/iconfont.css'
  17. Vue.use(ElementUI)
  18. Vue.use(VueCookie)
  19. Vue.config.productionTip = false
  20. // 非生产环境, 适配mockjs模拟数据 // api: https://github.com/nuysoft/Mock
  21. if (process.env.NODE_ENV !== 'production') {
  22. require('@/mock')
  23. }
  24. // 挂载全局
  25. Vue.prototype.$http = httpRequest // ajax请求方法
  26. Vue.prototype.isAuth = isAuth // 权限方法
  27. Vue.prototype.$message = Message // vue实例上挂载Message
  28. Vue.prototype.$messagebox = MessageBox // vue实例上挂载MessageBox
  29. // 保存整站vuex本地储存初始状态
  30. window.SITE_CONFIG['storeState'] = cloneDeep(store.state)
  31. /* eslint-disable no-new */
  32. new Vue({
  33. el: '#app',
  34. router,
  35. store,
  36. template: '<App/>',
  37. components: { App }
  38. })