第一次调用
wx.canvasToTempFilePath({ canvasId: 'shareLongImgInfo', complete: res => { console.log(res) if(res.tempFilePath){ that.setData({ longImgUrl: res.tempFilePath }) wx.previewImage({ urls: [res.tempFilePath] }) }else{ wx.showToast({ title: "生成长图失败" }) } wx.hideLoading() that.setData({ showLongImg: false }) }}) |
能够预览成功!
if(that.data.longImgUrl){ wx.previewImage({ urls: [that.data.longImgUrl] }); return} |
第二次直接调用 wx.canvasToTempFilePath 保存的临时路径 this.data.longImgUrl ,在安卓上,出现预览不成功,在模拟器上以及 iOS 上没有问题。
