// 保留两位小数,不四舍五入
toFixedFun(v) {
let toStr = v.toString()
let find = toStr.indexOf('.')
let rs = ''
if (find > -1) {
// 截取两位小数点 或 补0
let sp = toStr.split('.')
let len = sp[1].toString().split('').length
if (len > 1) {
rs = toStr.substring(0, find + 3)
} else {
rs = toStr + '0'
}
} else {
rs = Number(v).toFixed(2)
}
return rs
}
保留两位小数,不四舍五入
![](https://img-home.csdnimg.cn/images/20240711042549.png)