From 67950ee4b1e842a1e3dfa2500a2a0a63b3563ed7 Mon Sep 17 00:00:00 2001 From: tomfriwel <976932447@qq.com> Date: Mon, 4 Mar 2019 17:26:50 +0800 Subject: [PATCH] update --- dist/weapp-qrcode.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dist/weapp-qrcode.js b/dist/weapp-qrcode.js index 3c747cf..dfae409 100755 --- a/dist/weapp-qrcode.js +++ b/dist/weapp-qrcode.js @@ -310,14 +310,14 @@ var QRCode; } }; - QRCode.prototype.makeCode = function (sText) { + QRCode.prototype.makeCode = function (sText, callback) { this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); this._oQRCode.addData(sText); this._oQRCode.make(); - this.makeImage(); + this.makeImage(callback); }; - QRCode.prototype.makeImage = function () { + QRCode.prototype.makeImage = function (callback) { var _oContext if (this._htOption.usingIn) { _oContext = wx.createCanvasContext(this.canvasId, this._htOption.usingIn) @@ -395,7 +395,7 @@ var QRCode; } } - _oContext.draw() + _oContext.draw(false, callback) }; // 保存为图片,将临时路径传给回调 @@ -412,8 +412,10 @@ var QRCode; destHeight: this._htOption.height, canvasId: this.canvasId, success: function (res) { - console.log(res.tempFilePath) callback(res.tempFilePath) + }, + fail:res=>{ + console.log(res) } }) }