小程序调用wx.scanCode API时,扫描二维码可以,扫小程序码时没反应。帮我看下是什么原因
wx.scanCode({
scanType: ['barCode', 'qrCode', 'wxCode', 'datamatrix', 'pdf417'],
success: (res) => {
console.log("扫码结果:" + res); // 扫码结果
wx.showToast({
title: res.result,
icon: 'none'
});
},
fail: (err) => {
console.error("扫码失败:" + err);
// 处理扫码失败的情况
wx.showToast({
title: '扫码失败',
icon: 'none'
});
}
})

验证可以正常扫码的,提供下代码片段和复现小程序码呢(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
樓主解決了嗎?我的是掃描商品條形碼會出現沒反應的情況,能調出攝像頭并看到條形碼,但不能進行數據判斷,這個時候重新進入小程序多次才能正常。