main.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 plugins from './plugins' // plugins
  12. import { download } from '@/utils/request'
  13. import mavonEditor from 'mavon-editor'
  14. import 'mavon-editor/dist/css/index.css'
  15. import './api/mockServe/mock'
  16. import './assets/icons' // icon
  17. import './permission' // permission control
  18. import { getDicts } from "@/api/system/dict/data";
  19. import { getConfigKey } from "@/api/system/config";
  20. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  21. // 分页组件
  22. import Pagination from "@/components/Pagination";
  23. // 自定义表格工具组件
  24. import RightToolbar from "@/components/RightToolbar"
  25. // 富文本组件
  26. import Editor from "@/components/Editor"
  27. // 文件上传组件
  28. import FileUpload from "@/components/FileUpload"
  29. // 图片上传组件
  30. import ImageUpload from "@/components/ImageUpload"
  31. // 图片预览组件
  32. import ImagePreview from "@/components/ImagePreview"
  33. // 字典标签组件
  34. import DictTag from '@/components/DictTag'
  35. // 头部标签组件
  36. import VueMeta from 'vue-meta'
  37. // 字典数据组件
  38. import DictData from '@/components/DictData'
  39. // 将中国标准时间转化为年月日时分秒
  40. import formatDate from '@/utils/formatDate'
  41. // 全局方法挂载
  42. Vue.prototype.getDicts = getDicts
  43. Vue.prototype.getConfigKey = getConfigKey
  44. Vue.prototype.parseTime = parseTime
  45. Vue.prototype.resetForm = resetForm
  46. Vue.prototype.addDateRange = addDateRange
  47. Vue.prototype.selectDictLabel = selectDictLabel
  48. Vue.prototype.selectDictLabels = selectDictLabels
  49. Vue.prototype.download = download
  50. Vue.prototype.handleTree = handleTree
  51. Vue.prototype.$formatDate = formatDate
  52. // 全局组件挂载
  53. Vue.component('DictTag', DictTag)
  54. Vue.component('Pagination', Pagination)
  55. Vue.component('RightToolbar', RightToolbar)
  56. Vue.component('Editor', Editor)
  57. Vue.component('FileUpload', FileUpload)
  58. Vue.component('ImageUpload', ImageUpload)
  59. Vue.component('ImagePreview', ImagePreview)
  60. Vue.use(directive)
  61. Vue.use(plugins)
  62. Vue.use(VueMeta)
  63. Vue.use(mavonEditor)
  64. DictData.install()
  65. /**
  66. * If you don't want to use mock-server
  67. * you want to use MockJs for mock api
  68. * you can execute: mockXHR()
  69. *
  70. * Currently MockJs will be used in the production environment,
  71. * please remove it before going online! ! !
  72. */
  73. Vue.use(Element, {
  74. size: Cookies.get('size') || 'medium' // set element-ui default size
  75. })
  76. Vue.config.productionTip = false
  77. new Vue({
  78. el: '#app',
  79. router,
  80. store,
  81. render: h => h(App)
  82. })