小程序在wxml中能对字符串进行操作么

发布于 7 年前作者 nalai7312 次浏览最后编辑 7 年前来自 ask

在wxml中{{item.indexOf(‘http’)}}不输出任何东西是怎么回事呢?

5 回复
uchen
uchen1 楼6 年前

请问怎么解决的?感觉wxml很多方法用不了

yangzheng
yangzheng3 楼6 年前

只能先处理了再在页面上输出了

jingfan
jingfan4 楼6 年前
<wxs module="helper">
  var idxOf = function(array, item) {
    return array.indexOf(item.toString());
  }
 
  module.exports.indexOf = idxOf;
</wxs>
chao99
chao995 楼5 年前

貌似不能