main.js 2.5 KB

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