微信小程序「渲染層網絡層錯誤」解決方法


解決方案:利用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