canvasToTempFilePath: fail canvas is empty
发布于 7 年前 作者 flu 2552 次浏览 来自 官方Issues
3 回复

wxml没看到呢?wxml里面没写canvas-id=“share” 写到id里面去了吗?

const ctx = wx.createCanvasContext('share', that)

const that = this;

setTimeout(()=>{

wx.canvasToTempFilePath({

x: 0,

y: 0,

width: 332,

height: 360,

destWidth: 332 / 2,

destHeight: 360 / 2,

canvasId: 'share',

success(res){

console.log(res)

wx.saveImageToPhotosAlbum({

filePath: res.tempFilePath,

success(result){

console.log(result);

wx.showToast({

title: '证件已保存至相册',

icon: 'none'

})

},

fail(err){

console.log(err)

}

})

},

fail(err){

console.log(err)

}

}, that)

}, 500)

创建上下文和保存的时候都传入了this,但还报错找不到

回到顶部