main.js 2.8 KB

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