function handleNum(num) {
if (num < 1000) {
return num
}
if (num < 10000 && num >= 1000) {
let numArr = ((num / 1000) + '').split('.')
if (numArr.length > 1) {
if (numArr[1][0] === '0') {
return numArr[0] + '000+'
} else {
return numArr[0] + numArr[1][0] + '00+'
}
} else {
return (numArr[0] + '000+')
}
} else if (num >= 10000) {
let numArr = ((num / 10000) + '').split('.')
if (numArr.length > 1) {
if (numArr[1][0] === '0') {
return numArr[0] + '万+'
} else {
return numArr[0] + '.' + numArr[1][0] + '万+'
}
} else {
return (numArr[0] + '万+')
}
}
}
评论数、销量的数量格式化
最新推荐文章于 2024-11-04 17:05:06 发布