Commit 1d981af5 by 李伟康

utils(TrafficProviderInformation): 添加文本格式化工具函数

- 新增 formatText 工具函数处理空值显示为破折号
- 替换原有三元运算符逻辑为统一的格式化方法
- 保持现有功能不变的情况下提高代码可读性
1 parent 48733095
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<component :is="i.addComponent" :value.sync="componentData[i.key]" isViewMode <component :is="i.addComponent" :value.sync="componentData[i.key]" isViewMode
:list="componentData[i.listKey]" /> :list="componentData[i.listKey]" />
</template> </template>
<template v-else> {{ componentData[i.key] || '-' }}</template> <template v-else> {{ formatText(componentData[i.key]) }}</template>
<template <template
v-if="i.unit && componentData[i.key] != null && componentData[i.key] != '' && componentData[i.key] != undefined"> v-if="i.unit && componentData[i.key] != null && componentData[i.key] != '' && componentData[i.key] != undefined">
...@@ -297,6 +297,10 @@ export default { ...@@ -297,6 +297,10 @@ export default {
}) })
} }
return flag return flag
},
formatText(val){
if(val == null || val === '' || val == undefined) return '-'
else return val
} }
}, },
mounted() { mounted() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!