main.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import Vue from 'vue'
  2. import Element from 'element-ui'
  3. import './assets/styles/element-variables.scss'
  4. import '@/assets/styles/index.scss' // global css
  5. import '@/assets/styles/ruoyi.scss' // ruoyi css
  6. import App from './App'
  7. import store from './store'
  8. import router from './router'
  9. import directive from './directive' // directive
  10. import plugins from './plugins' // plugins
  11. import { download } from '@/utils/request'
  12. import './assets/icons' // icon
  13. import './permission' // permission control
  14. import TreeSelect from "@riophae/vue-treeselect";
  15. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  16. import { getDicts } from "@/api/system/dict/data";
  17. import { getConfigKey } from "@/api/system/config";
  18. import {
  19. parseTime,
  20. resetForm,
  21. addDateRange,
  22. selectDictLabel,
  23. selectDictLabels,
  24. handleTree,
  25. formatTime
  26. } from "@/utils/ruoyi";
  27. // 分页组件
  28. import Pagination from "@/components/Pagination";
  29. // 自定义表格工具组件
  30. import RightToolbar from "@/components/RightToolbar"
  31. // 富文本组件
  32. import Editor from "@/components/Editor"
  33. // 文件上传组件
  34. import FileUpload from "@/components/FileUpload"
  35. // 图片上传组件
  36. import ImageUpload from "@/components/ImageUpload"
  37. // 图片预览组件
  38. import ImagePreview from "@/components/ImagePreview"
  39. // 字典标签组件
  40. import DictTag from '@/components/DictTag'
  41. // 头部标签组件
  42. import VueMeta from 'vue-meta'
  43. // 字典数据组件
  44. import DictData from '@/components/DictData'
  45. // 全局方法挂载
  46. Vue.prototype.getDicts = getDicts
  47. //根据参数键名查询参数值
  48. Vue.prototype.getConfigKey = getConfigKey
  49. //格式化时间
  50. Vue.prototype.parseTime = parseTime
  51. //格式化时间
  52. Vue.prototype.formatTime = formatTime
  53. //重置表单
  54. Vue.prototype.resetForm = resetForm
  55. //添加日期范围
  56. Vue.prototype.addDateRange = addDateRange
  57. //回显数据字典
  58. Vue.prototype.selectDictLabel = selectDictLabel
  59. // 回显数据字典(字符串、数组)
  60. Vue.prototype.selectDictLabels = selectDictLabels
  61. Vue.prototype.download = download
  62. Vue.prototype.handleTree = handleTree
  63. // 全局组件挂载
  64. Vue.component('DictTag', DictTag)
  65. Vue.component('Pagination', Pagination)
  66. Vue.component('RightToolbar', RightToolbar)
  67. Vue.component('Editor', Editor)
  68. Vue.component('FileUpload', FileUpload)
  69. Vue.component('ImageUpload', ImageUpload)
  70. Vue.component('ImagePreview', ImagePreview)
  71. Vue.use(TreeSelect)
  72. Vue.use(directive)
  73. Vue.use(plugins)
  74. Vue.use(VueMeta)
  75. DictData.install()
  76. /**
  77. * If you don't want to use mock-server
  78. * you want to use MockJs for mock api
  79. * you can execute: mockXHR()
  80. *
  81. * Currently MockJs will be used in the production environment,
  82. * please remove it before going online! ! !
  83. */
  84. Vue.use(Element, {
  85. size: sessionStorage.getItem('size') || 'medium' // set element-ui default size
  86. })
  87. Vue.config.productionTip = false
  88. new Vue({
  89. el: '#app',
  90. router,
  91. store,
  92. render: h => h(App)
  93. })