-
新建xxx.wxs文件,比如
// 格式化金额 function toFixed(num){ num = (num / 100); return num.toFixed(2); } function formatDate(tiem) { // 详细的逻辑 } module.exports = { toFixed: toFixed, formatDate: formatDate }
-
在需要使用wxml文件中导入
<wxs src="../../../wxs/index.wxs" module="F"/>
-
使用
<text class="ren">¥</text> <text class="priceNum"> {{F.toFixed(item.minPrice)}} </text>
网友评论