1、创建 wxs 文件
function indexOf11(a, b) {
if (a.indexOf(b) >= 0) {
return true;
} else {
return false;
}
}
module.exports = {
indexOf11: indexOf11,
};
2、文件内使用
<wxs src="../../utils/indexOf.wxs" module="str" />
<view
wx:for="{{chatRecordList}}"
wx:for-item="item"
wx:for-index="index"
wx:key="item"
class="itemitemitem"
id="{{item.idd}}"
>
<view wx:if="{{myemchatId==item.to}}" class="left">
<view>
<image
src="{{userInfo.userInfo.userIcon}}"
style="width: 80rpx;height: 80rpx;border-radius: 50%;"
></image>
<view class="text" wx:if="{{item.data}}">
<view
wx:if="{{item.data}}"
wx:for="{{item.data}}"
wx:for-item="item_"
wx:key="item_"
wx:for-index="index_"
class="cccc"
>
<text wx:if="{{str.indexOf11(item_,'./faces/ee_')?false:true}}"
>{{item_}}</text
>
<image src="{{item_}}" wx:else class="emoemoemo"></image>
</view>
</view>
<view class="imageEmchat" wx:if="{{item.url}}">
<image src="{{item.url}}" style="width: 400rpx;height: 400rpx;"></image>
</view>
</view>
</view>
<view wx:else class="right">
<view>
<image
src="{{myAvatar}}"
style="width: 80rpx;height: 80rpx;border-radius: 50%;"
></image>
<view class="text">{{item.msg||item.data}}</view>
</view>
</view>
</view>