export const numToFixed = (val = 0, num = 2) => {
val = Number(val)
val = isNaN(val) ? 0 : val
return val.toFixed(num)
}
js toFixed 保留N位小数点方法封装
最新推荐文章于 2024-06-22 13:47:05 发布
export const numToFixed = (val = 0, num = 2) => {
val = Number(val)
val = isNaN(val) ? 0 : val
return val.toFixed(num)
}