Merge remote-tracking branch 'origin/master'

pull/43/head
YunaiV 2024-03-01 13:20:49 +08:00
commit a0e9ceb945
1 changed files with 4 additions and 2 deletions

View File

@ -55,8 +55,10 @@ export function formatNum(prefix, type, num) {
// 情况三:大于 10除第一位外其它位都显示为0
// 例如100 - 199 显示为 100+
// 9000 - 9999 显示为 9000+
let pow = Math.pow(10, `${num}`.length - 1);
return `${prefix}${(num / pow) * pow}+`;
const numStr = num.toString();
const first = numStr[0];
const other = '0'.repeat(numStr.length - 1);
return `${prefix}${first}${other}+`;
}
// 格式化价格