main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. import '@/icons' // icon
  11. import '@/permission' // permission control
  12. import api from '@/api/index' // all api
  13. Vue.$api = Vue.prototype.$api = api
  14. Vue.$dictData = Vue.prototype.$dictData = window.sessionStorage.getItem('fp_dictData') ? JSON.parse(window.sessionStorage.getItem('fp_dictData')) : {}
  15. import msg from '@/utils/msg'
  16. Vue.use(msg)
  17. import mixins from '_m'
  18. window.mixins = [mixins]
  19. import { noEmpty } from '@/utils'
  20. Vue.noEmpty = Vue.prototype.noEmpty = noEmpty
  21. import TableList from '@/components/Common/TableList'
  22. import BaseForm from '@/components/Common/BaseForm'
  23. import HeaderCollapse from '@/components/Common/HeaderCollapse'
  24. Vue.component(TableList.name, TableList)
  25. Vue.component(BaseForm.name, BaseForm)
  26. Vue.component(HeaderCollapse.name, HeaderCollapse)
  27. import storage from '@/utils/storage'
  28. Vue.use(storage)
  29. import VueAMap from 'vue-amap' // 高德
  30. Vue.use(VueAMap)
  31. VueAMap.initAMapApiLoader({
  32. key: '8343df94cab859af3bd36362029a4e19',
  33. plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PlaceSearch', 'AMap.Geolocation', 'AMap.Geocoder'],
  34. v: '1.4.15',
  35. uiVersion: '1.0' })
  36. /**
  37. * If you don't want to use mock-server
  38. * you want to use MockJs for mock api
  39. * you can execute: mockXHR()
  40. *
  41. * Currently MockJs will be used in the production environment,
  42. * please remove it before going online ! ! !
  43. */
  44. if (process.env.NODE_ENV === 'production') {
  45. const { mockXHR } = require('../mock')
  46. mockXHR()
  47. }
  48. // set ElementUI lang to EN
  49. // Vue.use(ElementUI, { locale })
  50. // 如果想要中文版 element-ui,按如下方式声明
  51. Vue.use(ElementUI)
  52. Vue.config.productionTip = false
  53. new Vue({
  54. el: '#app',
  55. router,
  56. store,
  57. render: h => h(App)
  58. })