//千分符
const formatNum = (num) => {
if (num === null) {
return 0
}
let value = num + '';
value = value.replace(/,/g, "");
if (/^[1-9]\d*$/.test(value)) {
value = value.replace(/(?=(?!\b)(?:\d{3})+(?!\d))/g, ",");
}
if (value.includes('.')) {
let tempArr = value.split('.')
if (Array.isArray(tempArr) && tempArr.length === 2) {
const tempStr = tempArr[0].replace(/(?=(?!\b)(?:\d{3})+(?!\d))/g, ",");
value = tempStr + '.' + tempArr[1]
}
}
return value;
}