vue js 保留小数

 toFixed(number,fractionDigits ){
                //number  保留小数数
                //fractionDigits 保留小数位数
                 var times = Math.pow(10, fractionDigits);
                 var roundNum = Math.round(number * times) / times;
                 return roundNum.toFixed(fractionDigits);
 }

  

posted @ 2018-11-13 14:35  贵哥好懒  阅读(5616)  评论(0)    收藏  举报