创建wxs文件
导出函数
var typeofFunc = function(value) {
return typeof value == "number";
};
module.exports = {
typeofFunc: typeofFunc
};
wxml中引用函数
<wxs src="./interpretation-report-sports.wxs" module="typeofFunc" />
使用函数
<view wx:if="{{item.recommendIntake !='限制'&&typeofFunc.typeofFunc(item.recommendIntake)}}" class="lastContent-green displayFlexAlignCenter">
<view style="{{'width:'+item.recommendIntake}}%"></view>
<view>{{'<'+item.recommendIntake}}</view>
</view>