Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 8x 11x 11x 11x 11x 11x | /**
* 求一个数保留小数,不四舍五入
* @param num 数字
* @param decimal 精度
*/
export const formatDecimalNoRound = (num: number | string, decimal: number) => {
num = num.toString();
const index = num.indexOf('.');
Eif (index !== -1) {
num = num.substring(0, decimal + index + 1);
} else {
num = num.substring(0);
}
return Number(parseFloat(num).toFixed(decimal));
}
|