main.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import 'normalize.css/normalize.css' // a modern alternative to CSS resets
  4. import Element from 'element-ui'
  5. import './assets/styles/element-variables.scss'
  6. import '@/assets/styles/index.scss' // global css
  7. import '@/assets/styles/ruoyi.scss' // ruoyi css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import permission from './directive/permission'
  12. import './assets/icons' // icon
  13. import './permission' // permission control
  14. import { getDicts } from "@/api/system/dict/data";
  15. import { getConfigKey } from "@/api/system/config";
  16. import { parseTime, resetForm, addDateRange, selectDictLabel, download, handleTree } from "@/utils/ruoyi";
  17. import Pagination from "@/components/Pagination";
  18. // 全局方法挂载
  19. Vue.prototype.getDicts = getDicts
  20. Vue.prototype.getConfigKey = getConfigKey
  21. Vue.prototype.parseTime = parseTime
  22. Vue.prototype.resetForm = resetForm
  23. Vue.prototype.addDateRange = addDateRange
  24. Vue.prototype.selectDictLabel = selectDictLabel
  25. Vue.prototype.download = download
  26. Vue.prototype.handleTree = handleTree
  27. Vue.prototype.msgSuccess = function (msg) {
  28. this.$message({ showClose: true, message: msg, type: "success" });
  29. }
  30. Vue.prototype.msgError = function (msg) {
  31. this.$message({ showClose: true, message: msg, type: "error" });
  32. }
  33. Vue.prototype.msgInfo = function (msg) {
  34. this.$message.info(msg);
  35. }
  36. // 全局组件挂载
  37. Vue.component('Pagination', Pagination)
  38. Vue.use(permission)
  39. /**
  40. * If you don't want to use mock-server
  41. * you want to use MockJs for mock api
  42. * you can execute: mockXHR()
  43. *
  44. * Currently MockJs will be used in the production environment,
  45. * please remove it before going online! ! !
  46. */
  47. Vue.use(Element, {
  48. size: Cookies.get('size') || 'medium' // set element-ui default size
  49. })
  50. Vue.config.productionTip = false
  51. new Vue({
  52. el: '#app',
  53. router,
  54. store,
  55. render: h => h(App)
  56. })