瀏覽代碼

feat: 气浮为0的时候不在显示--

sunxiao 4 周之前
父節點
當前提交
e609716996
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/views/control/components/BaseChooseItem.vue

+ 5 - 2
src/views/control/components/BaseChooseItem.vue

@@ -53,9 +53,12 @@ watchEffect(() => {
     inpVal.value = modelValue1.value;
   }
 })
+function isValidNumber(value) {
+  return typeof value === 'number' && value === value;
+}
 
-const onePoolNum = computed(() => (modelValue1.value && modelValue1.value !=0 ) ?  Number((modelValue1.value || 0).toFixed(2)) : '--');
-const twoPoolNum = computed(() => (modelValue2.value && modelValue2.value !=0 ) ?  Number((modelValue2.value || 0).toFixed(2)) : '--');
+const onePoolNum = computed(() => (isValidNumber(modelValue1.value)) ?  Number((modelValue1.value || 0).toFixed(2)) : '--');
+const twoPoolNum = computed(() => (isValidNumber(modelValue2.value)) ?  Number((modelValue2.value || 0).toFixed(2)) : '--');
 
 const onInpCancel = (val) => {
   inpVal.value = val;