// 数字 小数点 前面每隔 3 位插入逗号
export const numberAddCommas = (num) => {
num = num.toString();
num = Number(num.replace(/,/g, '')).toFixed(2);
num = num
.toString()
.replace(/,/g, '')
.replace(/(\d)(?=(\d{3})+\.)/g, function ($1, $2, $3) {
console.log($1, $2, $3);
return $2 + ',';
});
return num;
};
// 数字 小数点 前面每隔 3 位插入逗号