main.js 2.1 KB

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