Fix NaN download count
This commit is contained in:
parent
267c002e01
commit
07291e3363
|
@ -5,7 +5,15 @@ import {isWeiXin} from "../../utils/navigatorUtils";
|
||||||
|
|
||||||
function parseValue(value) {
|
function parseValue(value) {
|
||||||
if (value < 10000) return 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 <sup className="Gray">{value + "万"}</sup>
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WxMessage = () => {
|
const WxMessage = () => {
|
||||||
|
@ -17,7 +25,7 @@ const WxMessage = () => {
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImgBox = ({ imgData }) => {
|
const ImgBox = ({ imgData }) => {
|
||||||
|
@ -41,8 +49,8 @@ const PartDownload = ({ value, downloadCount, onSvgDownload, onImgDownload }) =>
|
||||||
<div className="Qr-Centered title-margin">
|
<div className="Qr-Centered title-margin">
|
||||||
<div className="Qr-s-title">Downloads</div>
|
<div className="Qr-s-title">Downloads</div>
|
||||||
<p className="Qr-s-subtitle">
|
<p className="Qr-s-subtitle">
|
||||||
下载二维码 — {value}
|
<span>下载二维码 — {value}</span>
|
||||||
<sup className="Gray"> {parseValue(downloadCount)}</sup>
|
<CountComponent value={downloadCount} />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="Qr-Centered">
|
<div className="Qr-Centered">
|
||||||
|
|
Loading…
Reference in New Issue