index.ts 936 B

123456789101112131415161718192021222324252627282930
  1. import type { App } from 'vue'
  2. import {
  3. PackagesCategoryEnum,
  4. PackagesType,
  5. ConfigType
  6. } from '@/packages/index.d'
  7. import { ChartList } from '@/packages/components/Chart/index'
  8. import { DecorateList } from '@/packages/components/Decorate/index'
  9. import { InformationList } from '@/packages/components/Information/index'
  10. import { TableList } from '@/packages/components/Table/index'
  11. // 所有图表
  12. let packagesList: PackagesType = {
  13. [PackagesCategoryEnum.CHARTS]: ChartList,
  14. [PackagesCategoryEnum.INFORMATION]: InformationList,
  15. [PackagesCategoryEnum.TABLES]: TableList,
  16. [PackagesCategoryEnum.DECORATES]: DecorateList
  17. }
  18. // 注册
  19. const packagesInstall = (app: App): void => {
  20. for (const item in packagesList) {
  21. const chartList: ConfigType[] = (packagesList as any)[item]
  22. chartList.forEach((chart: ConfigType) => {
  23. app.component(chart.key, chart.node)
  24. })
  25. }
  26. }
  27. export { packagesList, packagesInstall }