From b9ee4546b71d7619bcda6f7a3c9ed9f2c1df57cd Mon Sep 17 00:00:00 2001 From: hzm <934585316@qq.com> Date: Tue, 24 Feb 2026 15:18:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E6=95=B0=E5=AD=97=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/page.jsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/page.jsx b/app/page.jsx index bc2c9fa..354f51c 100644 --- a/app/page.jsx +++ b/app/page.jsx @@ -83,17 +83,26 @@ function ScanButton({ onClick, disabled }) { ); } -// 数字滚动组件 +// 数字滚动组件(初始化时无动画,后续变更再动画) function CountUp({ value, prefix = '', suffix = '', decimals = 2, className = '', style = {} }) { const [displayValue, setDisplayValue] = useState(value); const previousValue = useRef(value); + const isFirstChange = useRef(true); useEffect(() => { if (previousValue.current === value) return; + // 首次数值变化(包括从 0/默认值变为实际数据)不做动画,直接跳到目标值 + if (isFirstChange.current) { + isFirstChange.current = false; + previousValue.current = value; + setDisplayValue(value); + return; + } + const start = previousValue.current; const end = value; - const duration = 600; // 0.6秒动画 + const duration = 400; // 0.4秒动画 const startTime = performance.now(); const animate = (currentTime) => { @@ -156,7 +165,8 @@ function GroupSummary({ funds, holdings, groupName, getProfit, stickyTop }) { hasHolding = true; totalAsset += profit.amount; if (profit.profitToday != null) { - totalProfitToday += profit.profitToday; + // 与卡片展示口径一致:先按“分”四舍五入再汇总,避免浮点误差/逐项舍入差导致不一致 + totalProfitToday += Math.round(profit.profitToday * 100) / 100; hasAnyTodayData = true; } if (profit.profitTotal !== null) {