This commit is contained in:
‘huanghaiixia’
2026-01-29 18:16:02 +08:00
parent 3a441823c9
commit 9643a693a2
8 changed files with 51 additions and 19 deletions

View File

@ -0,0 +1,10 @@
export function numToThousands(number) {
if (number === null || number === undefined || number === '') return ''
let arr = number.toString().split('.')
let num = arr[0]
let float = arr[1]
let str = num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
return float ? (str + '.'+ float) : str;
}