- /*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>
来源: http://www.bubuko.com/infodetail-2671164.html