fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 3m13s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 3m13s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
/**
|
||||
* 格式化金额
|
||||
* @param {number} value 金额数值
|
||||
* @param {number} decimals 小数位数
|
||||
* @returns {string} 格式化后的金额字符串
|
||||
*/
|
||||
export const formatMoney = (value) => {
|
||||
export const formatMoney = (value, decimals = 1) => {
|
||||
if (!value && value !== 0) {
|
||||
return '0'
|
||||
return Number(0).toFixed(decimals)
|
||||
}
|
||||
return Number(value)
|
||||
.toFixed(0)
|
||||
.toFixed(decimals)
|
||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user