round参数配置成0时,会无效

This commit is contained in:
rickcole 2020-05-20 12:22:28 +08:00
parent 612e7ecccf
commit 52f4f96cca

View File

@ -171,7 +171,7 @@ export const filters: {
return 0;
}
decimals = parseInt(decimals, 10) || 2;
decimals = parseInt(decimals, 10) ?? 2;
let multiplier = Math.pow(10, decimals);
return (Math.round(input * multiplier) / multiplier).toFixed(decimals);