main.js 2.5 KB

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