使用 toFixed(2) 方法 注意: toFixed只能针对数字类型才能使用,所以对于字符类型的要用parseFloat或者parseInt函数先转一下再调用 如果是字符类型的情况下: parseFloat(val).toFixed(2); 或者 Number(val).toFixed(2);