You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
692 B
20 lines
692 B
var numberUtil = {
|
|
numberFormat: function (value) {
|
|
var v = parseInt(value) //强转Int,毕竟有可能返回是String类型的数字
|
|
return v.toFixed(0)
|
|
},
|
|
numberFormat1: function (value) {
|
|
// var v = parseInt(value) //强转Int,毕竟有可能返回是String类型的数字
|
|
return value.toFixed(2)
|
|
},
|
|
// 过千万保留一位小数
|
|
numberFormat2: function (value) {
|
|
// var v = parseInt(value) //强转Int,毕竟有可能返回是String类型的数字
|
|
return value.toFixed(1)
|
|
}
|
|
}
|
|
module.exports = {
|
|
numberFormat: numberUtil.numberFormat,
|
|
numberFormat1: numberUtil.numberFormat1, //暴露接口调用
|
|
numberFormat2: numberUtil.numberFormat2
|
|
}
|