Commit 7b53f85e27998a7feb094bd9a5fe2917f5e1c3fd

Authored by ww
1 parent 3bc570c2

fix: data component not setting unit field will render null

@@ -89,6 +89,16 @@ @@ -89,6 +89,16 @@
89 } 89 }
90 ); 90 );
91 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 + );
  101 +
92 let timeout: Nullable<number> = null; 102 let timeout: Nullable<number> = null;
93 103
94 function handleRandomValue() { 104 function handleRandomValue() {
@@ -101,6 +111,7 @@ @@ -101,6 +111,7 @@
101 initChart(); 111 initChart();
102 props.add && props.add(props.value.id, update); 112 props.add && props.add(props.value.id, update);
103 if (props.random) timeout = setInterval(handleRandomValue, 2000) as unknown as number; 113 if (props.random) timeout = setInterval(handleRandomValue, 2000) as unknown as number;
  114 + console.log(unref(chartRef));
104 }); 115 });
105 116
106 onUnmounted(() => { 117 onUnmounted(() => {
@@ -107,10 +107,9 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp @@ -107,10 +107,9 @@ export const instrumentComponent1 = (params?: Partial<ComponentInfo>): EChartsOp
107 lineHeight: 30, 107 lineHeight: 30,
108 borderRadius: 8, 108 borderRadius: 8,
109 offsetCenter: [0, '-15%'], 109 offsetCenter: [0, '-15%'],
110 - // fontSize: 16,  
111 fontSize: 14, 110 fontSize: 14,
112 fontWeight: 'bolder', 111 fontWeight: 'bolder',
113 - formatter: `{value} ${unit ?? '°C'}`, 112 + formatter: `{value} ${unit ?? ''}`,
114 color: params?.fontColor || 'inherit', 113 color: params?.fontColor || 'inherit',
115 }, 114 },
116 data: [ 115 data: [
@@ -219,7 +218,7 @@ export const instrumentComponent2 = (params?: Partial<ComponentInfo>): EChartsOp @@ -219,7 +218,7 @@ export const instrumentComponent2 = (params?: Partial<ComponentInfo>): EChartsOp
219 }, 218 },
220 detail: { 219 detail: {
221 valueAnimation: true, 220 valueAnimation: true,
222 - formatter: `{value} ${unit}`, 221 + formatter: `{value} ${unit ?? ''}`,
223 color: params?.fontColor || 'inherit', 222 color: params?.fontColor || 'inherit',
224 fontSize: 14, 223 fontSize: 14,
225 }, 224 },