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