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