微信小程序-01 小数保留二位

/*wxs*/
var filters = {
     toFix:function(value,count){
        var num = Number(value)
        return num.toFixed(count)
     }
}
module.exports = {
   toFix: filters.toFix
}

/*wxml*/
<wxs module="filters" src="路径"></wxs>
<view>{{filters.toFix(item.price,2)}}</view>
原文地址:https://www.cnblogs.com/lemonphp/p/9264420.html