我也有这个问题
drawImage在开发工具上可以正常使用,真机上不正常let context = wx.createCanvasContext('myCanvas',this); context.drawImage("data:image/jpeg;base64," + wx.arrayBufferToBase64(res.data), 0, 0, 150, 100); context.draw(true, function (rs){ wx.canvasToTempFilePath({ canvasId: 'myCanvas', success: function (res) { self.setData({ tempSavePath: res.tempFilePath }); } }) });
2018-05-16遇到这个问题
wx.canvasToTempFilePath 无效,求助如下代码控制台只显示0000,wx.canvasToTempFilePath的回调函数没有被调用 previewImg: function() { console.log("0000"); wx.canvasToTempFilePath({ canvasId: 'myCanvas', success(res2) { console.log("111"); console.log(res2.tempFilePath); }, fail(res) { console.log("22"); }, complete(res) { console.log("332"); } }); }, 模板 <canvas class="mainImg" canvas-id="myCanvas" catchtap="previewImg"></canvas>
2018-05-16