main.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import Vue from 'vue'
  2. import { useAntd } from 'k-form-design/packages/core/useComponents'
  3. import KFormDesign from 'k-form-design/packages/use.js'
  4. import 'k-form-design/lib/k-form-design.css'
  5. import Cookies from 'js-cookie'
  6. import Element from 'element-ui'
  7. import './assets/styles/element-variables.scss'
  8. import '@/assets/styles/index.scss' // global css
  9. import '@/assets/styles/ruoyi.scss' // ruoyi css
  10. import App from './App'
  11. import store from './store'
  12. import router from './router'
  13. import directive from './directive' // directive
  14. import plugins from './plugins' // plugins
  15. import { download } from '@/utils/request'
  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. import JsonExcel from 'vue-json-excel'
  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. // 全局组件挂载
  51. Vue.component('downloadExcel', JsonExcel)
  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. Vue.use(directive)
  60. Vue.use(plugins)
  61. Vue.use(VueMeta)
  62. DictData.install()
  63. useAntd(Vue)
  64. Vue.use(KFormDesign)
  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. })