main.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 '@/styles/index.scss' // global css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import '@/icons' // icon
  11. import '@/permission' // permission control
  12. //新增
  13. import hasBtnPermission from '@/utils/btn-permission'
  14. Vue.prototype.$hasBP = hasBtnPermission
  15. /**
  16. * If you don't want to use mock-server
  17. * you want to use MockJs for mock api
  18. * you can execute: mockXHR()
  19. *
  20. * Currently MockJs will be used in the production environment,
  21. * please remove it before going online ! ! !
  22. */
  23. if (process.env.NODE_ENV === 'production') {
  24. const { mockXHR } = require('../mock')
  25. mockXHR()
  26. }
  27. // set ElementUI lang to EN
  28. Vue.use(ElementUI, { locale })
  29. // 如果想要中文版 element-ui,按如下方式声明
  30. // Vue.use(ElementUI)
  31. Vue.config.productionTip = false
  32. new Vue({
  33. el: '#app',
  34. router,
  35. store,
  36. render: h => h(App)
  37. })