From 1629c56cc55889b9977d68a61135f7bb303efcc6 Mon Sep 17 00:00:00 2001 From: selia-zx <1771203023@qq.com> Date: Thu, 10 Jul 2025 09:40:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=83=BD=E8=80=97=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../energyAnalysis/components/energyReport.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/views/hotWater/energyAnalysis/components/energyReport.vue b/src/views/hotWater/energyAnalysis/components/energyReport.vue index 7c65ea7..0f5a845 100644 --- a/src/views/hotWater/energyAnalysis/components/energyReport.vue +++ b/src/views/hotWater/energyAnalysis/components/energyReport.vue @@ -251,11 +251,18 @@ export default { }, methods: { isPositive(value) { - // 提取数字部分并去除百分号 - const numberPart = value.replace("%", ""); - // 将提取的字符串转换为数字类型 - const num = parseFloat(numberPart); - return num > 0; + // 检查 value 是否为字符串 + if (typeof value === "string") { + // 提取数字部分并去除百分号 + const numberPart = value.replace("%", ""); + // 将提取的字符串转换为数字类型 + const num = parseFloat(numberPart); + return num > 0; + } else { + // 处理非字符串类型的情况 + // console.error("传入的值不是字符串类型:", value); + return false; + } }, handleEnter(index) { this.currentIndex = index;