main.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. import CopyButton from '@/components/Common/copy-button.vue'
  29. Vue.component('CopyButton', CopyButton);
  30. Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_API + 'img/get?key=';
  31. /**
  32. * If you don't want to use mock-server
  33. * you want to use MockJs for mock api
  34. * you can execute: mockXHR()
  35. *
  36. * Currently MockJs will be used in the production environment,
  37. * please remove it before going online ! ! !
  38. */
  39. if (process.env.NODE_ENV === 'production') {
  40. const { mockXHR } = require('../mock')
  41. mockXHR()
  42. }
  43. // set ElementUI lang to EN
  44. // Vue.use(ElementUI, { locale })
  45. // 如果想要中文版 element-ui,按如下方式声明
  46. Vue.use(ElementUI)
  47. // register global utility filters
  48. Object.keys(filters).forEach(key => {
  49. Vue.filter(key, filters[key])
  50. })
  51. Vue.config.productionTip = false
  52. new Vue({
  53. el: '#app',
  54. router,
  55. store,
  56. render: h => h(App)
  57. })