wx.canvasToTempFilePath BUG

发布于 6 年前作者 ywan19033 次浏览最后编辑 6 年前来自 ask

第一次调用

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 上没有问题。

0 回复
暂无回复