如下代码控制台只显示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>