main.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 directive from './directive' //directive
  11. import { download } from '@/utils/request'
  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, selectDictLabels, handleTree } from "@/utils/ruoyi";
  17. import Pagination from "@/components/Pagination";
  18. // 自定义表格工具组件
  19. import RightToolbar from "@/components/RightToolbar"
  20. // 富文本组件
  21. import Editor from "@/components/Editor"
  22. // 文件上传组件
  23. import FileUpload from "@/components/FileUpload"
  24. // 图片上传组件
  25. import ImageUpload from "@/components/ImageUpload"
  26. // 字典标签组件
  27. import DictTag from '@/components/DictTag'
  28. // 头部标签组件
  29. import VueMeta from 'vue-meta'
  30. // 全局方法挂载
  31. Vue.prototype.getDicts = getDicts
  32. Vue.prototype.getConfigKey = getConfigKey
  33. Vue.prototype.parseTime = parseTime
  34. Vue.prototype.resetForm = resetForm
  35. Vue.prototype.addDateRange = addDateRange
  36. Vue.prototype.selectDictLabel = selectDictLabel
  37. Vue.prototype.selectDictLabels = selectDictLabels
  38. Vue.prototype.download = download
  39. Vue.prototype.handleTree = handleTree
  40. Vue.prototype.msgSuccess = function (msg) {
  41. this.$message({ showClose: true, message: msg, type: "success" });
  42. }
  43. Vue.prototype.msgError = function (msg) {
  44. this.$message({ showClose: true, message: msg, type: "error" });
  45. }
  46. Vue.prototype.msgInfo = function (msg) {
  47. this.$message.info(msg);
  48. }
  49. // 全局组件挂载
  50. Vue.component('DictTag', DictTag)
  51. Vue.component('Pagination', Pagination)
  52. Vue.component('RightToolbar', RightToolbar)
  53. Vue.component('Editor', Editor)
  54. Vue.component('FileUpload', FileUpload)
  55. Vue.component('ImageUpload', ImageUpload)
  56. Vue.use(directive)
  57. Vue.use(VueMeta)
  58. /**
  59. * If you don't want to use mock-server
  60. * you want to use MockJs for mock api
  61. * you can execute: mockXHR()
  62. *
  63. * Currently MockJs will be used in the production environment,
  64. * please remove it before going online! ! !
  65. */
  66. Vue.use(Element, {
  67. size: Cookies.get('size') || 'medium' // set element-ui default size
  68. })
  69. Vue.config.productionTip = false
  70. new Vue({
  71. el: '#app',
  72. router,
  73. store,
  74. render: h => h(App)
  75. })