//默认图片路径 globleData.definedImageHostUrl;
单个图片
<image src=‘{{object.image}}‘ binderror="imageError" data-object="{{object}}"></image>
//对象默认图片设置 imageError:function(e){ var object = e.currentTarget.dataset.object; object.image = globleData.definedImageHostUrl; this.setData({ object: object }) },
列表图片
<image src=‘{{item.image}}‘ binderror="imageErrorList" data-index="{{index}}"></image>
//列表默认图设置 imageErrorList: function (e) { var index = e.currentTarget.dataset.index; var list= this.data.list;//列表从data内获取 list[index].image = globleData.definedImageHostUrl; this.setData({ list: list }) },
双层for列表
<image src=‘{{item2.image}}‘ binderror="imageErrorList" data-index="{{index}} data-index2="{{index2}}"></image>
//列表默认图设置 imageErrorList: function (e) { var index = e.currentTarget.dataset.index; var index2 = e.currentTarget.dataset.index2; var list= this.data.list;//列表从data内获取 list[index].list2[index2].image = globleData.definedImageHostUrl; this.setData({ list: list }) },