vue项目中使用 num.toFixed()函数时,出现“toFixed() is not a function”的解决办法

toFixed只能针对数字类型才能使用,所以对于字符类型的要用parseFloat或者parseInt函数先转一下再调用

如下操作:

filters:{
      showPrice(price){
        return '¥'+ parseInt(price).toFixed(2)
      }
    },
原文地址:https://www.cnblogs.com/gzw-23/p/12752429.html