main.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 {
  36. dictDataEcho,
  37. dictValueLabel,
  38. moneyFormat,
  39. calculationWeek,
  40. getDict,
  41. getDictOne,
  42. getPdf,
  43. getPdfA3,
  44. translateIntoEnglish,
  45. random
  46. } from '@/utils/util'
  47. // 分页组件
  48. import Pagination from '@/components/Pagination'
  49. // 自定义表格工具组件
  50. import RightToolbar from '@/components/RightToolbar'
  51. // 文件上传组件
  52. import FileUpload from "@/components/FileUpload"
  53. // 图片上传组件
  54. import ImageUpload from "@/components/ImageUpload"
  55. // 图片预览组件
  56. import ImagePreview from "@/components/ImagePreview"
  57. // 自定义树选择组件
  58. import TreeSelect from '@/components/TreeSelect'
  59. // 字典标签组件
  60. import DictTag from '@/components/DictTag'
  61. const app = createApp(App)
  62. // 全局方法挂载
  63. app.config.globalProperties.useDict = useDict
  64. app.config.globalProperties.get = get
  65. app.config.globalProperties.post = post
  66. app.config.globalProperties.download = download
  67. app.config.globalProperties.parseTime = parseTime
  68. app.config.globalProperties.resetForm = resetForm
  69. app.config.globalProperties.handleTree = handleTree
  70. app.config.globalProperties.addDateRange = addDateRange
  71. app.config.globalProperties.selectDictLabel = selectDictLabel
  72. app.config.globalProperties.selectDictLabels = selectDictLabels
  73. //字典回显
  74. app.config.globalProperties.dictDataEcho = dictDataEcho
  75. app.config.globalProperties.dictValueLabel = dictValueLabel
  76. app.config.globalProperties.moneyFormat = moneyFormat
  77. app.config.globalProperties.calculationWeek = calculationWeek
  78. app.config.globalProperties.getDict = getDict
  79. app.config.globalProperties.getDictOne = getDictOne
  80. app.config.globalProperties.getPdf = getPdf
  81. app.config.globalProperties.getPdfA3 = getPdfA3
  82. app.config.globalProperties.translateIntoEnglish = translateIntoEnglish
  83. app.config.globalProperties.random = random
  84. // 全局组件挂载
  85. app.component('DictTag', DictTag)
  86. app.component('Pagination', Pagination)
  87. app.component('TreeSelect', TreeSelect)
  88. app.component('FileUpload', FileUpload)
  89. app.component('ImageUpload', ImageUpload)
  90. app.component('ImagePreview', ImagePreview)
  91. app.component('RightToolbar', RightToolbar)
  92. app.use(router)
  93. app.use(store)
  94. app.use(plugins)
  95. app.use(elementIcons)
  96. app.component('svg-icon', SvgIcon)
  97. directive(app)
  98. // 使用element-plus 并且设置全局的大小
  99. app.use(ElementPlus, {
  100. locale: locale,
  101. // 支持 large、default、small
  102. size: Cookies.get('size') || 'default'
  103. })
  104. app.mount('#app')