...
|
...
|
@@ -21,6 +21,7 @@ |
21
|
21
|
fontSize,
|
22
|
22
|
} from '../../detail/config/util';
|
23
|
23
|
import { Tooltip } from 'ant-design-vue';
|
|
24
|
+ import { useThrottleFn } from '@vueuse/shared';
|
24
|
25
|
|
25
|
26
|
const props = defineProps({
|
26
|
27
|
add: {
|
...
|
...
|
@@ -81,23 +82,28 @@ |
81
|
82
|
return (_radio: number) => {};
|
82
|
83
|
};
|
83
|
84
|
|
84
|
|
- watch(
|
85
|
|
- () => props.value.value,
|
86
|
|
- (newValue) => {
|
87
|
|
- const updateFn = getUpdateValueFn(props.layout.componentType);
|
88
|
|
- unref(chartRef)?.setOption((updateFn(newValue || 0) as unknown as EChartsOption) || {});
|
89
|
|
- }
|
90
|
|
- );
|
91
|
|
-
|
92
|
|
- watch(
|
93
|
|
- () => props.radio,
|
94
|
|
- () => {
|
95
|
|
- const option = beforeUpdateFn(props.layout.componentType);
|
96
|
|
- setTimeout(() => {
|
97
|
|
- unref(chartRef)?.setOption((option(unref(getRadio)) as unknown as EChartsOption) || {});
|
98
|
|
- });
|
99
|
|
- }
|
100
|
|
- );
|
|
85
|
+ const updateChartValue = useThrottleFn((newValue) => {
|
|
86
|
+ const updateFn = getUpdateValueFn(props.layout.componentType);
|
|
87
|
+ unref(chartRef)?.setOption((updateFn(newValue || 0) as unknown as EChartsOption) || {});
|
|
88
|
+ }, 500);
|
|
89
|
+
|
|
90
|
+ watch(() => props.value.value, updateChartValue);
|
|
91
|
+
|
|
92
|
+ const updateChartFont = useThrottleFn(() => {
|
|
93
|
+ const option = beforeUpdateFn(props.layout.componentType);
|
|
94
|
+ setTimeout(() => {
|
|
95
|
+ unref(chartRef)?.setOption((option(unref(getRadio)) as unknown as EChartsOption) || {});
|
|
96
|
+ });
|
|
97
|
+ }, 500);
|
|
98
|
+
|
|
99
|
+ watch(() => props.radio, updateChartFont);
|
|
100
|
+
|
|
101
|
+ const updateChartType = useThrottleFn(() => {
|
|
102
|
+ unref(chartRef)?.clear();
|
|
103
|
+ unref(chartRef)?.setOption(props?.layout?.chartOption || {});
|
|
104
|
+ }, 500);
|
|
105
|
+
|
|
106
|
+ watch(() => props.layout.chartOption, updateChartType);
|
101
|
107
|
|
102
|
108
|
let timeout: Nullable<number> = null;
|
103
|
109
|
|
...
|
...
|
|