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 locale from 'element-plus/es/locale/lang/zh-cn'
  6. import '@/assets/styles/index.scss' // global css
  7. import 'virtual:uno.css' // uno 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. import {TdtMap} from '@/utils/tiandituMap'
  16. // 天地图适配层全局注册,供各 GIS 页面通过 window.TdtMap 使用
  17. window.TdtMap = TdtMap
  18. // svg图标
  19. import 'virtual:svg-icons-register'
  20. import SvgIcon from '@/components/SvgIcon'
  21. import elementIcons from '@/components/SvgIcon/svgicon'
  22. import './permission' // permission control
  23. import {useDict} from '@/utils/dict'
  24. import {addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels} from '@/utils/ruoyi'
  25. // 分页组件
  26. import Pagination from '@/components/Pagination'
  27. // 自定义表格工具组件
  28. import RightToolbar from '@/components/RightToolbar'
  29. // 富文本组件
  30. import Editor from "@/components/Editor"
  31. // 文件上传组件
  32. import FileUpload from "@/components/FileUpload"
  33. // 图片上传组件
  34. import ImageUpload from "@/components/ImageUpload"
  35. // 图片预览组件
  36. import ImagePreview from "@/components/ImagePreview"
  37. // 自定义树选择组件
  38. import TreeSelect from '@/components/TreeSelect'
  39. // 字典标签组件
  40. import DictTag from '@/components/DictTag'
  41. const app = createApp(App)
  42. // 全局方法挂载
  43. app.config.globalProperties.useDict = useDict
  44. app.config.globalProperties.download = download
  45. app.config.globalProperties.parseTime = parseTime
  46. app.config.globalProperties.resetForm = resetForm
  47. app.config.globalProperties.handleTree = handleTree
  48. app.config.globalProperties.addDateRange = addDateRange
  49. app.config.globalProperties.selectDictLabel = selectDictLabel
  50. app.config.globalProperties.selectDictLabels = selectDictLabels
  51. // 全局组件挂载
  52. app.component('DictTag', DictTag)
  53. app.component('Pagination', Pagination)
  54. app.component('TreeSelect', TreeSelect)
  55. app.component('FileUpload', FileUpload)
  56. app.component('ImageUpload', ImageUpload)
  57. app.component('ImagePreview', ImagePreview)
  58. app.component('RightToolbar', RightToolbar)
  59. app.component('Editor', Editor)
  60. app.use(router)
  61. app.use(store)
  62. app.use(plugins)
  63. app.use(elementIcons)
  64. app.component('svg-icon', SvgIcon)
  65. directive(app)
  66. // 使用element-plus 并且设置全局的大小
  67. app.use(ElementPlus, {
  68. locale: locale,
  69. // 支持 large、default、small
  70. size: Cookies.get('size') || 'default'
  71. })
  72. app.mount('#app')