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) }
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) }