he wei
2025-01-13 8ffb54b88e3907ea59c120d34a8cd9f486cc1151
1
2
3
4
5
6
7
8
9
10
/**
 * 数值保留指定位数小数
 */
export default function toFixed(value, bit) {
  if (!value) {
    return 0;
  }
  const num = Math.pow(10, bit);
  return Math.round(value * num) / num;
}