main.js 1.8 KB

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