js 保留两位小数不四舍五入
function customToFixed(num: string, len: number = 2) { num = num.toString() let index = num.indexOf('.') if (index !== -1) { num = num.substring(0, index + 1 + len) } else { num = num.substring(0) } return parseFloat(num).toFixed(len) }