Vue 报replace is not a function,replace错误

错误再现:

weight.replace()

错误信息为replace is not function ,这个函数只能用于字符串,当是数字的时候就会报此错误。

 解决办法:

        将数字转换成字符串再replace。

weight.toString().replace()

猜你喜欢

转载自blog.csdn.net/m0_73900214/article/details/131795144