码迷,mamicode.com
首页 > 其他好文 > 详细

把价钱转化为xx.xx的形式

时间:2016-11-10 14:44:50      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:类型   this   价格   dex   ring   pre   int   taf   let   

把number类型转化为字符串类型
let orderPayFeeStr = this.state.orderPayFee.toString();//商品价格转化为字符串
if(orderPayFeeStr.indexOf(".") != -1){
orderPayFeepointBefore = orderPayFeeStr.split(".")[0];
orderPayFeepointAfter = orderPayFeeStr.split(".")[1].length == 1?orderPayFeeStr.split(".")[1]+"0":orderPayFeeStr.split(".")[1];
}else{
orderPayFeepointBefore = orderPayFeeStr;
orderPayFeepointAfter = "00";
}
以上是react框架中用

把价钱转化为xx.xx的形式

标签:类型   this   价格   dex   ring   pre   int   taf   let   

原文地址:http://www.cnblogs.com/luckyXcc/p/6050557.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!