From 07291e3363805af49f7aa7a98490cdb29d9b5dee Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Thu, 4 Mar 2021 19:47:50 +0800 Subject: [PATCH] Fix NaN download count --- src/components/app/PartDownload.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/app/PartDownload.js b/src/components/app/PartDownload.js index 6aa4da1..22a04ee 100644 --- a/src/components/app/PartDownload.js +++ b/src/components/app/PartDownload.js @@ -5,7 +5,15 @@ import {isWeiXin} from "../../utils/navigatorUtils"; function parseValue(value) { if (value < 10000) return value; - return (value / 10000).toFixed(1) + "万"; + return +} + +const CountComponent = ({ value }) => { + if (value >= 10000) value = (value / 10000).toFixed(1); + if (!isNaN(value)) { + return {value + "万"} + } + return null; } const WxMessage = () => { @@ -17,7 +25,7 @@ const WxMessage = () => { ) } - return null + return null; } const ImgBox = ({ imgData }) => { @@ -41,8 +49,8 @@ const PartDownload = ({ value, downloadCount, onSvgDownload, onImgDownload }) =>
Downloads

- 下载二维码 — {value} - {parseValue(downloadCount)} + 下载二维码 — {value} +