main.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. import PopupBigImg from '@/components/Common/PopupBigImg'
  25. Vue.component(TableList.name, TableList)
  26. Vue.component(BaseForm.name, BaseForm)
  27. Vue.component(HeaderCollapse.name, HeaderCollapse)
  28. Vue.component(PopupBigImg.name, PopupBigImg)
  29. import storage from '@/utils/storage'
  30. Vue.use(storage)
  31. import imgMark from '@/utils/imgMark'
  32. Vue.use(imgMark)
  33. import dataV from '@jiaminghi/data-view'
  34. Vue.use(dataV)
  35. import VueAMap from 'vue-amap' // 高德
  36. Vue.use(VueAMap)
  37. VueAMap.initAMapApiLoader({
  38. key: '8343df94cab859af3bd36362029a4e19',
  39. plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PlaceSearch', 'AMap.Geolocation', 'AMap.Geocoder'],
  40. v: '1.4.15',
  41. uiVersion: '1.0' })
  42. /**
  43. * If you don't want to use mock-server
  44. * you want to use MockJs for mock api
  45. * you can execute: mockXHR()
  46. *
  47. * Currently MockJs will be used in the production environment,
  48. * please remove it before going online ! ! !
  49. */
  50. if (process.env.NODE_ENV === 'production') {
  51. const { mockXHR } = require('../mock')
  52. mockXHR()
  53. }
  54. // set ElementUI lang to EN
  55. // Vue.use(ElementUI, { locale })
  56. // 如果想要中文版 element-ui,按如下方式声明
  57. Vue.use(ElementUI)
  58. Vue.config.productionTip = false
  59. new Vue({
  60. el: '#app',
  61. router,
  62. store,
  63. render: h => h(App)
  64. })