"canvasToTempFilePath: fail canvas is em
在draw中调用canvasToTempFilePath失败
步骤: [代码]cxtImg.draw([代码][代码]false[代码][代码], that.saveToImg(mycanvasId))[代码][代码]saveToImg: [代码][代码]function[代码] [代码](mycanvasId) {[代码][代码] [代码][代码]console.log([代码][代码]"3.callback:mycanvasId:::"[代码][代码],mycanvasId);[代码][代码] [代码][代码]wx.canvasToTempFilePath({[代码][代码] [代码][代码]x: [代码][代码]0[代码][代码],[代码][代码]//画布X轴起点(默认0)[代码][代码] [代码][代码]y: [代码][代码]0[代码][代码],[代码][代码]//画布Y轴起点(默认0)[代码][代码] [代码][代码]width: [代码][代码]200[代码][代码],[代码][代码]//画布宽度(默认为canvas宽度-x)[代码][代码] [代码][代码]height: [代码][代码]200[代码][代码],[代码][代码]//画布高度(默认为canvas高度-x)[代码][代码] [代码][代码]destWidth: [代码][代码]200[代码] [代码]* [代码][代码]2[代码][代码], [代码][代码]//输出画布宽度(默认为width)[代码][代码] [代码][代码]destHeight: [代码][代码]200[代码] [代码]* [代码][代码]2[代码][代码],[代码][代码]//输出画布高度(默认为height)[代码][代码] [代码][代码]canvasId: mycanvasId,[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]wx.saveImageToPhotosAlbum({[代码][代码] [代码][代码]imagePath: res.tempFilePath,[代码][代码] [代码][代码]})[代码][代码] [代码][代码]// var tempFilePath=res.tempFilePath;[代码][代码] [代码][代码]console.log([代码][代码]"3.输出画布成功!!!tempFilePath:::"[代码][代码], tempFilePath);[代码][代码] [代码][代码]// that.data.imagePath = that.data.imagePath.concat(tempFilePath); [代码][代码] [代码][代码]// console.log("3.输出画布成功!!!that.data.imagePath:::", that.data.imagePath);[代码][代码] [代码][代码]wx.hideToast()[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail(res) {[代码][代码] [代码][代码]console.log([代码][代码]"3.输出画布失败!!!::"[代码][代码], res);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}, [代码][代码]this[代码][代码])[代码][代码] [代码][代码]},[代码]控制台输出 [代码]输出画布失败!!!:: {errMsg: [代码][代码]"canvasToTempFilePath: fail canvas is empty"[代码][代码]}[代码]