index.vue 814 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <VChart :theme="themeData" :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 {
  11. GridComponent,
  12. TooltipComponent,
  13. LegendComponent
  14. } from 'echarts/components'
  15. import config from './config'
  16. const props = defineProps({
  17. themeData: {
  18. type: Object || String,
  19. default: 'dark',
  20. required: true
  21. },
  22. chartData: {
  23. type: Object as PropType<config>,
  24. required: true
  25. }
  26. })
  27. use([
  28. CanvasRenderer,
  29. LineChart,
  30. GridComponent,
  31. TooltipComponent,
  32. LegendComponent
  33. ])
  34. const option = computed(() => {
  35. return props.chartData.option
  36. })
  37. </script>