小程序在WXML中使用函數

官方文檔https://developers.weixin.qq.com/miniprogram/dev/reference/wxs/01wxs-module.html

我這裏是做一個將for循環中的值 取整 

wxml中引入 

<wxs module="filters" src="./filters.wxs"></wxs>
//使用
<view wx:if="{{message.type === 'audio'}}" class='audio-wrapper-Ltext '>
   {{filters.toFix(message.audio.dur / 1000)}}''
</view>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章