微信小程序「渲染层网络层错误」解决方法


解决方案:利用bindload判断图片加载完毕,修改状态显示图片

wxml:

1 <view wx:for="{{flash}}">
3     <image src="{{item.loadReady ? item.img : '默认图'}}" bindload="imageLoadReady" data-index="{{index}}" data-key="flash"></image>
5 </view>

js:

1     //图片加载
2     imageLoadReady(e){
3       let th = this;
4       let images = th.data[e.currentTarget.dataset.key];
5       images[e.currentTarget.dataset.index].loadReady = true;
6       th.setData({
7         [e.currentTarget.dataset.key]:images
8       })
9     }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM