main.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 * as echarts from 'echarts'
  7. Vue.prototype.$echarts = echarts
  8. import '@/styles/index.scss' // global css
  9. import App from './App'
  10. import store from './store'
  11. import router from './router'
  12. import '@/icons' // icon
  13. import '@/permission' // permission control
  14. import * as filters from './filters' // global filters
  15. // 成功/错误提示
  16. import {successMsg, errorMsg, warningNotify, checkBtnRole, getSummaries, numToFixed} from '@/utils/common.js'
  17. Vue.prototype.$successMsg = successMsg;
  18. Vue.prototype.$errorMsg = errorMsg;
  19. Vue.prototype.$warningNotify = warningNotify;
  20. Vue.prototype.$checkBtnRole = checkBtnRole;
  21. Vue.prototype.$getSummaries = getSummaries;
  22. Vue.prototype.$numToFixed = numToFixed;
  23. // 自定义组件
  24. import ExportButton from '@/components/Common/export-button.vue'
  25. Vue.component('ExportButton', ExportButton);
  26. import ImportButton from '@/components/Common/import-button.vue'
  27. Vue.component('ImportButton', ImportButton);
  28. Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_API + 'img/get?key=';
  29. /**
  30. * If you don't want to use mock-server
  31. * you want to use MockJs for mock api
  32. * you can execute: mockXHR()
  33. *
  34. * Currently MockJs will be used in the production environment,
  35. * please remove it before going online ! ! !
  36. */
  37. if (process.env.NODE_ENV === 'production') {
  38. const { mockXHR } = require('../mock')
  39. mockXHR()
  40. }
  41. // set ElementUI lang to EN
  42. // Vue.use(ElementUI, { locale })
  43. // 如果想要中文版 element-ui,按如下方式声明
  44. Vue.use(ElementUI)
  45. // register global utility filters
  46. Object.keys(filters).forEach(key => {
  47. Vue.filter(key, filters[key])
  48. })
  49. Vue.config.productionTip = false
  50. new Vue({
  51. el: '#app',
  52. router,
  53. store,
  54. render: h => h(App)
  55. })