main.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { createApp } from 'vue'
  2. import Cookies from 'js-cookie'
  3. import ElementPlus from 'element-plus'
  4. import 'element-plus/dist/index.css'
  5. import 'element-plus/theme-chalk/dark/css-vars.css'
  6. import locale from 'element-plus/es/locale/lang/zh-cn'
  7. import '@/assets/styles/index.scss' // global css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import directive from './directive' // directive
  12. // 注册指令
  13. import plugins from './plugins' // plugins
  14. import { download } from '@/utils/request'
  15. // svg图标
  16. import 'virtual:svg-icons-register'
  17. import SvgIcon from '@/components/SvgIcon'
  18. import elementIcons from '@/components/SvgIcon/svgicon'
  19. import './permission' // permission control
  20. import { useDict } from '@/utils/dict'
  21. import { getConfigKey } from "@/api/system/config"
  22. import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
  23. // 分页组件
  24. import Pagination from '@/components/Pagination'
  25. // 自定义表格工具组件
  26. import RightToolbar from '@/components/RightToolbar'
  27. // 富文本组件
  28. import Editor from "@/components/Editor"
  29. // 文件上传组件
  30. import FileUpload from "@/components/FileUpload"
  31. // 图片上传组件
  32. import ImageUpload from "@/components/ImageUpload"
  33. // 图片预览组件
  34. import ImagePreview from "@/components/ImagePreview"
  35. // 字典标签组件
  36. import DictTag from '@/components/DictTag'
  37. // 字体
  38. import './assets/styles/css/font.css'
  39. const app = createApp(App)
  40. // 全局方法挂载
  41. app.config.globalProperties.useDict = useDict
  42. app.config.globalProperties.download = download
  43. app.config.globalProperties.parseTime = parseTime
  44. app.config.globalProperties.resetForm = resetForm
  45. app.config.globalProperties.handleTree = handleTree
  46. app.config.globalProperties.addDateRange = addDateRange
  47. app.config.globalProperties.getConfigKey = getConfigKey
  48. app.config.globalProperties.selectDictLabel = selectDictLabel
  49. app.config.globalProperties.selectDictLabels = selectDictLabels
  50. // 全局组件挂载
  51. app.component('DictTag', DictTag)
  52. app.component('Pagination', Pagination)
  53. app.component('FileUpload', FileUpload)
  54. app.component('ImageUpload', ImageUpload)
  55. app.component('ImagePreview', ImagePreview)
  56. app.component('RightToolbar', RightToolbar)
  57. app.component('Editor', Editor)
  58. app.use(router)
  59. app.use(store)
  60. app.use(plugins)
  61. app.use(elementIcons)
  62. app.component('svg-icon', SvgIcon)
  63. directive(app)
  64. // 使用element-plus 并且设置全局的大小
  65. app.use(ElementPlus, {
  66. locale: locale,
  67. // 支持 large、default、small
  68. size: Cookies.get('size') || 'default'
  69. })
  70. app.mount('#app')