页面中的一些图片在ios手机下不能正常渲染,显示空白,点击打开控制台图片才会渲染出来,请问这是什么问题?有其他人遇到过类似的问题吗?
|
< view class = "share_wrap" > < view class = "pic_con" > < block wx:if="{{sharedata.shareUrl.length>0}}"> < image src = "{{sharedata.shareUrl}}" class = "fade_in pic_ad" mode = "aspectFit" ></ image > </ block > < block wx:if = "{{sharedata.shareUrl.length<=0}}" > < image src = "/images/img_place.png" class = "fade_in pic_place" mode = "aspectFit" ></ image > </ block > </ view > < view class = "opera-box" > < view class = "btn-box bg-orange" > < button type = "primary" open-type = "share" ></ button > < text >分享给朋友</ text > </ view > < view class = "btn-box bg-green" bindtap = "saveImage" > < button type = "primary" ></ button > < text >保存卡片</ text > </ view > </ view > </ view > <!--错误提示--> < view class = "error-tip fade_in" wx:if = "{{errorTip.isShow}}" > {{errorTip.text}} </ view > |
var app = getApp(); Page({ data: { }, onLoad: function (e) { var that = this ; that.setData({ sharedata: app.globalData.sharedata }) console.log(that.data.sharedata); }, onShareAppMessage: function () { var title = this .data.sharedata.shareTitle; return { title: title, path: '/pages/index/index' } }, saveImage: function (){ var that = this ; var imgpath = this .data.sharedata.shareUrl; if (imgpath.length<=0){ app.errorTip(that, "海报图片不存在" , 2000); return ; } wx.showLoading({ title: '正在保存' , mask: true , time: 100000 }) wx.downloadFile({ url: imgpath, success: function (res) { console.log(res); wx.saveImageToPhotosAlbum({ filePath: res.tempFilePath, success(res) { console.log(res); app.errorTip(that, "图片保存成功" , 2000); }, fail(f) { app.errorTip(that, "图片保存失败" , 2000); }, complete(){ wx.hideLoading(); } }) } }) } }) |
这是
这几个文件对应的代码