main.js 2.1 KB

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