页面中调用wx.scanCode success回调不会被调用?
发布于 5 年前 作者 gang89 7261 次浏览 来自 官方Issues
weixin.call((wx)=>{
wx.scanQRCode({
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
   scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
   success: function (res) {
// var result = res.resultStr.scan_code.scan_result; // 当needResult 为 1 时,扫码返回的结果
     // callback(result)
     alert(JSON.stringify(res))
},
error:function(err){
//alert(err)
   }
});
})

如果needResult为0 调用时会跳转页面,但是为1时,success函数不被调用? 扫一扫已成功唤起

2 回复

你好,是指在web-view中使用没有回调?

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

不要 alert ,扫码成功后 webview 还处于后台状态,alert 是无效的

回到顶部