main.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. // 成功/错误提示
  30. import {successMsg, errorMsg, warningNotify, checkBtnRole, getSummaries, numToFixed} from '@/utils/common.js'
  31. Vue.prototype.$successMsg = successMsg;
  32. Vue.prototype.$errorMsg = errorMsg;
  33. Vue.prototype.$warningNotify = warningNotify;
  34. Vue.prototype.$checkBtnRole = checkBtnRole;
  35. Vue.prototype.$getSummaries = getSummaries;
  36. Vue.prototype.$numToFixed = numToFixed;
  37. Vue.prototype.$startLoading = startLoading
  38. Vue.prototype.$endLoading = endLoading
  39. // 自定义组件
  40. import ExportButton from '@/components/Common/export-button.vue'
  41. Vue.component('ExportButton', ExportButton);
  42. import ImportButton from '@/components/Common/import-button.vue'
  43. Vue.component('ImportButton', ImportButton);
  44. import CopyButton from '@/components/Common/copy-button.vue'
  45. Vue.component('CopyButton', CopyButton);
  46. Vue.prototype.$imageUrl = process.env.VUE_APP_BASE_API + 'img/get?key=';
  47. /**
  48. * If you don't want to use mock-server
  49. * you want to use MockJs for mock api
  50. * you can execute: mockXHR()
  51. *
  52. * Currently MockJs will be used in the production environment,
  53. * please remove it before going online ! ! !
  54. */
  55. if (process.env.NODE_ENV === 'production') {
  56. const { mockXHR } = require('../mock')
  57. mockXHR()
  58. }
  59. // set ElementUI lang to EN
  60. // Vue.use(ElementUI, { locale })
  61. // 如果想要中文版 element-ui,按如下方式声明
  62. Vue.use(ElementUI)
  63. // register global utility filters
  64. Object.keys(filters).forEach(key => {
  65. Vue.filter(key, filters[key])
  66. })
  67. Vue.config.productionTip = false
  68. new Vue({
  69. el: '#app',
  70. router,
  71. store,
  72. render: h => h(App)
  73. })