index.vue 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <VChart :theme="themeColor" :option="option" autoresize />
  3. </template>
  4. <script setup lang="ts">
  5. import { computed, PropType } from 'vue'
  6. import VChart from 'vue-echarts'
  7. import { use, graphic } from 'echarts/core'
  8. import { CanvasRenderer } from 'echarts/renderers'
  9. import { LineChart } from 'echarts/charts'
  10. import config, { includes } from './config'
  11. import { mergeTheme } from '@/packages/public/chart'
  12. import {
  13. GridComponent,
  14. TooltipComponent,
  15. LegendComponent,
  16. TitleComponent
  17. } from 'echarts/components'
  18. const props = defineProps({
  19. themeSetting: {
  20. type: Object,
  21. required: true
  22. },
  23. themeColor: {
  24. type: Object,
  25. required: true
  26. },
  27. chartConfig: {
  28. type: Object as PropType<config>,
  29. required: true
  30. }
  31. })
  32. use([
  33. CanvasRenderer,
  34. LineChart,
  35. GridComponent,
  36. TooltipComponent,
  37. LegendComponent,
  38. TitleComponent
  39. ])
  40. const option = computed(() => {
  41. return mergeTheme( props.chartConfig.option, props.themeSetting, includes)
  42. })
  43. </script>