[图片][图片]试了好多次,解决这个问题了
canvasToTempFilePath第二参数无论怎么整都是fail canvas is emp?下面代码,无论that放哪里,怎么整都提示:fcanvasToTempFilePath: fail canvas is empty,真是无语,麻烦求解,谢谢。 onReady: function () { var that = this; var context = wx.createCanvasContext('mycanvas',that); wx.chooseImage ({ success: function (res) { context.drawImage(res.tempFilePaths[0], 0, 0, 150, 100); context.fillStyle = "#FF0000"; context.fillRect(0, 0, 50, 50); context.draw(true, setTimeout(function() { wx.canvasToTempFilePath ({ destWidth: 150, destHeight: 100, canvasId: 'mycanvas', success: function (res) { console.log('1212' + res.tempFilePath); }, fail: function (res) {console.log(res);} },that); },300)); } }); }
2021-05-20