formatPrice(money) {
var tpMoney:any = '0.00';
if (money != null) {
tpMoney = money;
}
tpMoney = new Number(tpMoney);
if (isNaN(tpMoney)) {
return '0.00';
}
tpMoney = tpMoney.toFixed(2) + '';
var re = /^(-?\d+)(\d{3})(\.?\d*)/;
while (re.test(tpMoney)) {
tpMoney = tpMoney.replace(re, "$1,$2$3")
}
return tpMoney;
}
JS 实现金额格式化
最新推荐文章于 2024-04-30 10:08:22 发布