index.vue 719 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <VChart theme="dark" :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. chartData: {
  18. type: Object as PropType<config>,
  19. required: true
  20. }
  21. })
  22. use([
  23. CanvasRenderer,
  24. LineChart,
  25. GridComponent,
  26. TooltipComponent,
  27. LegendComponent
  28. ])
  29. const option = computed(() => {
  30. return props.chartData.option
  31. })
  32. </script>