/** * * */ test: async function(){ let that = this; console.log(1); await that.getCanvasImg().then(function(res){ console.log(res); console.log(2); }); console.log(3); await that.getCanvasImg().then(function(res){ console.log(res); console.log(4); }); console.log(5); }, /** * 获得canvas中的临时图片地址 */ getCanvasImg: function(res){ return new Promise((resolve,reject)=>{ let imgPath = ""; wx.canvasToTempFilePath({ width: 90, height: 90, destWidth: 150, destHeight: 150, canvasId: 'canvas_wx', success(res) { //console.log(res.tempFilePath); imgPath = res.tempFilePath; resolve(imgPath); }, fail(res){ reject(false); } }); }); },
参考 : https://www.jianshu.com/p/c1b629d104ac
|
请发表评论