he wei
2024-11-01 6fe5223e3ba751e7795d26f4d4f1cc2cfd648715
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;
}