帮忙看下,wx.canvasToTempFilePath没有反应
pyq:function(){ var that =this wx.showLoading({ title: '请稍后...', }) wx.request({ url: app.url +'addScan', daya:{ page:"pages/detail/detail", one:that.data.detail.id, two:that.data.toptjm }, success:function(res){ console.log(res.data) wx.hideLoading() var context = wx.createCanvasContext('mycanvas', this) context.drawImage(res.data, 50, 20, 200, 200) context.setFillStyle('#676050') context.setFontSize(18) context.setTextAlign('center') context.fillText("优趣商城",150,260) context.setFontSize(14) context.fillText(that.data.detail.name, 150, 300) context.setFontSize(12) context.fillText("立即扫码选购", 150, 380) context.draw(true, wx.canvasToTempFilePath({ canvasId: 'mycanvas', success: function (res) { console.log(res); // wx.saveImageToPhotosAlbum({ // filePath: res.tempFilePath, // success(result) { // console.log(result) // wx.showToast({ // title: '图片保存成功', // icon: 'success', // duration: 2000 // }) // } // }) that.setData({ scans: 1 }) } })); } }) }, |