在WXML上,直接使用{{data.substr(0, 10)}} 并没有任何作用
在WXML中创建.wxs文件,专门写对应的处理格式的方法。
<wxs module="func">
module.exports.slice = function (str, start, stop) {
return str.slice(start, stop)
};
</wxs>
直接引用
{{func.slice(item.phone,0,3)}}****{{func.slice(item.phone,7,11)}}