wx.canvasToTempFilePath问题
canvas隐藏时wx.canvasToTempFilePath有时会出现fail:illegal arguments(android手机)
wxml:
<canvas wx:if=’{{!showImage}}’ style=‘width: {{canvasWidth}}px; height: {{canvasHeight}}px’ canvas-id=“canvas”>
js:
…
ctx.draw()
wx.canvasToTempFilePath({
canvasId: ‘canvas’,
success: function (res) {
that.setData({ imageUrl: res.tempFilePath, showImage: true })
},
fail: function (err) {
console.error(‘wx.canvasToTempFilePath fail’, err)
}
})
有时会成功,有时会报错