main.js 2.7 KB

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