app.js

 //远程图片no found情况下指引    errImgFun:function (ev, that){    console.log("onImageError", ev);    var _errImg = ev.target.dataset.errImg;    var _errObj = {};    _errObj[_errImg] = "/img/00.jpg";//默认显示图片    that.setData(_errObj);  },

page页面

wxml:

<image src="{{item.WeChatPhoto}}" mode='widthFix' binderror="onImageError" data-err-img="seenote.seelist[{{index}}].WeChatPhoto"></image>//seenote.seelist[{{index}}].WeChatPhoto改成data里面数组中对应图片位置//binderror="onImageError"绑定图片加载错误事件

js:

const app = getApp() // 远程图片加载404显示默认图  onImageError: function (ev) {    //console.log("onImageError",ev);    var _that = this;    app.errImgFun(ev, _that);  },

 

TAG标签: 微信小程序404

http://www.xiaochengxub.com/read-100229.html