第一次扫描身份证时,会提示,但再次扫码时,没看到提示,即没有执行onSuccess的代码。
页面:
<ocr-navigator bind:onSuccess="onSuccess" certificateType="idCard" opposite="{{false}}">
<button>身份证识别</button>
</ocr-navigator>
js代码:
onSuccess(e){
console.log(e.detail)
var name = e.detail.name.text;
var idd = e.detail.id.text;
var that = this;
wx.showModal({
title: '提示',
content: '生成身份信息:' + name + '(' + idd + ')?',
success: function (res) {
if (res.confirm) {
qrcode({
width: 106,
height: 106,
canvasId: 'myQrcode',
text: 'name=' + name + ',idd=' + idd,
});
that.setData({
name:name,
idd:idd
});
} else if (res.cancel) {
console.log('用户点击取消!');
}
}
})
},