This commit is contained in:
Qiuxia Fan 2022-04-14 18:04:42 +08:00
parent a17cf4b6be
commit 139c5ac8f5

View File

@ -23,7 +23,7 @@ limitations under the License. -->
}" }"
> >
{{ singleVal.toFixed(2) }} {{ singleVal.toFixed(2) }}
<span class="unit" v-show="config.showUnit"> <span class="unit" v-show="config.showUnit && unit">
{{ decodeURIComponent(unit) }} {{ decodeURIComponent(unit) }}
</span> </span>
</div> </div>
@ -55,7 +55,9 @@ const metricConfig = computed(() => props.config.metricConfig || []);
const key = computed(() => Object.keys(props.data)[0]); const key = computed(() => Object.keys(props.data)[0]);
const singleVal = computed(() => Number(props.data[key.value])); const singleVal = computed(() => Number(props.data[key.value]));
const unit = computed( const unit = computed(
() => metricConfig.value[0] && encodeURIComponent(metricConfig.value[0].unit) () =>
metricConfig.value[0] &&
encodeURIComponent(metricConfig.value[0].unit || "")
); );
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>