Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tomfriwel committed Mar 4, 2019
1 parent 948b6a9 commit 67950ee
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions dist/weapp-qrcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -395,7 +395,7 @@ var QRCode;
}
}

_oContext.draw()
_oContext.draw(false, callback)
};

// 保存为图片,将临时路径传给回调
Expand All @@ -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)
}
})
}
Expand Down

0 comments on commit 67950ee

Please sign in to comment.