main.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 '../public/print-lock.css'
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import directive from './directive' // directive
  12. import plugins from './plugins' // plugins
  13. import { download } from '@/utils/request'
  14. import './assets/icons' // icon
  15. import './permission' // permission control
  16. import { getDicts } from "@/api/system/dict/data";
  17. import { getConfigKey } from "@/api/system/config";
  18. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  19. import { checkPermi } from './utils/permission';
  20. // 分页组件
  21. import Pagination from "@/components/Pagination";
  22. // 自定义表格工具组件
  23. import RightToolbar from "@/components/RightToolbar"
  24. // 富文本组件
  25. import Editor from "@/components/Editor"
  26. // 文件上传组件
  27. import FileUpload from "@/components/FileUpload"
  28. // 图片上传组件
  29. import ImageUpload from "@/components/ImageUpload"
  30. // 图片预览组件
  31. import ImagePreview from "@/components/ImagePreview"
  32. // 字典标签组件
  33. import DictTag from '@/components/DictTag'
  34. // 头部标签组件
  35. import VueMeta from 'vue-meta'
  36. // 字典数据组件
  37. import DictData from '@/components/DictData'
  38. import webSite from '@/config/website'
  39. Vue.prototype.website = webSite
  40. // 全局方法挂载
  41. Vue.prototype.getDicts = getDicts
  42. Vue.prototype.getConfigKey = getConfigKey
  43. Vue.prototype.parseTime = parseTime
  44. Vue.prototype.resetForm = resetForm
  45. Vue.prototype.addDateRange = addDateRange
  46. Vue.prototype.selectDictLabel = selectDictLabel
  47. Vue.prototype.selectDictLabels = selectDictLabels
  48. Vue.prototype.download = download
  49. Vue.prototype.handleTree = handleTree
  50. Vue.prototype.checkPermission = checkPermi
  51. // 全局组件挂载
  52. Vue.component('DictTag', DictTag)
  53. Vue.component('Pagination', Pagination)
  54. Vue.component('RightToolbar', RightToolbar)
  55. Vue.component('Editor', Editor)
  56. Vue.component('FileUpload', FileUpload)
  57. Vue.component('ImageUpload', ImageUpload)
  58. Vue.component('ImagePreview', ImagePreview)
  59. // 解决el-radio报错
  60. Vue.directive('removeAriaHidden', {
  61. bind(el, binding) {
  62. let ariaEls = el.querySelectorAll('.el-radio__original');
  63. ariaEls.forEach((item) => {
  64. item.removeAttribute('aria-hidden');
  65. });
  66. }
  67. });
  68. Vue.use(directive)
  69. Vue.use(plugins)
  70. Vue.use(VueMeta)
  71. DictData.install()
  72. /**
  73. * If you don't want to use mock-server
  74. * you want to use MockJs for mock api
  75. * you can execute: mockXHR()
  76. *
  77. * Currently MockJs will be used in the production environment,
  78. * please remove it before going online! ! !
  79. */
  80. Vue.use(Element, {
  81. size: Cookies.get('size') || 'medium' // set element-ui default size
  82. })
  83. Vue.config.productionTip = false
  84. new Vue({
  85. el: '#app',
  86. router,
  87. store,
  88. render: h => h(App)
  89. })