1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| <script lang="ts" setup>
| import type { EChartsOption } from 'echarts';
|
| import type { EchartsUIType } from '@vben/plugins/echarts';
|
| import { ref, watch } from 'vue';
|
| import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
| defineOptions({ name: 'TmsHomeChart' });
|
| const props = withDefaults(
| defineProps<{
| option: EChartsOption;
| height?: string;
| }>(),
| { height: '280px' },
| );
|
| const chartRef = ref<EchartsUIType>();
| const { renderEcharts } = useEcharts(chartRef);
|
| watch(
| () => props.option,
| (option) => {
| if (option) renderEcharts(option);
| },
| { deep: true, immediate: true },
| );
| </script>
|
| <template>
| <EchartsUI ref="chartRef" :height="height" width="100%" />
| </template>
|
|