async onLoad(){ var that = this ; wx.downloadFile({ url: that.imgStr, // 资源地址 success(res) { // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 if (res.statusCode === 200) { that.imgFilePath = res.tempFilePath; that.$apply(); that.drawImg(); console.log(res); } } }) that.$apply(); /* ctx.draw(false, function () { // wx.canvasToTempFilePath这个一定要写在ctx.draw里面的回调里面,是坑勿跳 wx.canvasToTempFilePath({ canvasId: "shareCanvas", destWidth: 600, destHeight: 800, quality: 1, success: function (res) { console.log(res.tempFilePath) callback(res.tempFilePath) }, fail: function (res) { console.log(res) } }) }) */ } async drawImg(){ var postersize = this .setCanvasSize(750); //动态设置画布大小 console.log(postersize); const ctx = wx.createCanvasContext( 'shareCanvas' , this ); console.log( this .imgFilePath); ctx.drawImage( this .imgFilePath, 0, 0, postersize.w, postersize.h); ctx.drawImage( this .imgFilePath, 30, 30, postersize.w, postersize.h); console.log( this .imgFilePath); ctx.draw(); } |
点右上角的...,有个 打开调试。。。
打开调试 是可以出来的 关掉调试 就出不来 甚至直接真机都能出来
那是因为你用到图片的下载 没在微信公众平台上面配置服务器域名
谢谢了 太感谢了 就是这个原因 出来了 谢谢谢谢谢谢
不客气 社区日常错误。。
大神啊 请快帮忙啊 崩溃了