main.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import {
  2. createApp
  3. } from 'vue'
  4. import Cookies from 'js-cookie'
  5. import ElementPlus from 'element-plus'
  6. import locale from 'element-plus/lib/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 {
  15. download,
  16. post,
  17. get
  18. } from '@/utils/request'
  19. // svg图标
  20. import 'virtual:svg-icons-register'
  21. import SvgIcon from '@/components/SvgIcon'
  22. import elementIcons from '@/components/SvgIcon/svgicon'
  23. import './permission' // permission control
  24. import {
  25. useDict
  26. } from '@/utils/dict'
  27. import {
  28. parseTime,
  29. resetForm,
  30. addDateRange,
  31. handleTree,
  32. selectDictLabel,
  33. selectDictLabels
  34. } from '@/utils/ruoyi'
  35. import { dictDataEcho, moneyFormat, calculationWeek,getDict } from '@/utils/util'
  36. // 分页组件
  37. import Pagination from '@/components/Pagination'
  38. // 自定义表格工具组件
  39. import RightToolbar from '@/components/RightToolbar'
  40. // 文件上传组件
  41. import FileUpload from "@/components/FileUpload"
  42. // 图片上传组件
  43. import ImageUpload from "@/components/ImageUpload"
  44. // 图片预览组件
  45. import ImagePreview from "@/components/ImagePreview"
  46. // 自定义树选择组件
  47. import TreeSelect from '@/components/TreeSelect'
  48. // 字典标签组件
  49. import DictTag from '@/components/DictTag'
  50. const app = createApp(App)
  51. // 全局方法挂载
  52. app.config.globalProperties.useDict = useDict
  53. app.config.globalProperties.get = get
  54. app.config.globalProperties.post = post
  55. app.config.globalProperties.download = download
  56. app.config.globalProperties.parseTime = parseTime
  57. app.config.globalProperties.resetForm = resetForm
  58. app.config.globalProperties.handleTree = handleTree
  59. app.config.globalProperties.addDateRange = addDateRange
  60. app.config.globalProperties.selectDictLabel = selectDictLabel
  61. app.config.globalProperties.selectDictLabels = selectDictLabels
  62. //字典回显
  63. app.config.globalProperties.dictDataEcho = dictDataEcho
  64. app.config.globalProperties.moneyFormat = moneyFormat
  65. app.config.globalProperties.calculationWeek = calculationWeek
  66. app.config.globalProperties.getDict = getDict
  67. // 全局组件挂载
  68. app.component('DictTag', DictTag)
  69. app.component('Pagination', Pagination)
  70. app.component('TreeSelect', TreeSelect)
  71. app.component('FileUpload', FileUpload)
  72. app.component('ImageUpload', ImageUpload)
  73. app.component('ImagePreview', ImagePreview)
  74. app.component('RightToolbar', RightToolbar)
  75. app.use(router)
  76. app.use(store)
  77. app.use(plugins)
  78. app.use(elementIcons)
  79. app.component('svg-icon', SvgIcon)
  80. directive(app)
  81. // 使用element-plus 并且设置全局的大小
  82. app.use(ElementPlus, {
  83. locale: locale,
  84. // 支持 large、default、small
  85. size: Cookies.get('size') || 'default'
  86. })
  87. app.mount('#app')