使用toFixed(2)的时候一定要注意,必须是Number类型,如果是String类型,需要进行转换。 const a = '11.2354'; a.toFixed(2)时会报错,正确使用方法如下: Numer(a).toFixed(2)