在本地用IOS端测试基座,可以扫描,而且扫描结果也可以进行传递。但是打包后,用安卓机,就无法扫描二维码。摄像头是可以成功调用的,但是对着二维码扫码怎么都没反应。也没有扫描到二维码那种滴的一生。。就像什么都没有发生过一样。。有人遇到过吗?(T.T)快一个星期了,没有大佬遇到过相关问题吗?????
<script type='text/ecmascript-6'>
let scan = null
export default {
data() {
return {
}
},
methods: {
// 创建扫描控件
startRecognize() {
let that = this
if (!window.plus) return
// eslint-disable-next-line
scan = new plus.barcode.Barcode('bcid')
scan.onmarked = onmarked
function onmarked(type, result, file) {
switch (type) {
// eslint-disable-next-line
case plus.barcode.QR:
type = 'QR'
break
// eslint-disable-next-line
case plus.barcode.EAN13:
type = 'EAN13'
break
// eslint-disable-next-line
case plus.barcode.EAN8:
type = 'EAN8'
break
default:
type = '其它' + type
break
}
// 获得code
result = result.replace(/\n/g, '')
if(result){
// 成功,关闭控件,带参数跳转到正常页面去
alert(result);
that.closeScan();
that.$router.push({
path:"/wallet/send",
query:{addr:result}
});
}else{
// 失败,关闭控件,重新扫描
alert('失败了?');
that.closeScan();
that.$router.push({
path:"/wallet/send",
});
}
}
},
// 开始扫描
startScan() {
if (!window.plus) return
scan.start()
},
// 关闭扫描
cancelScan() {
if (!window.plus) return
scan.cancel()
},
// 关闭条码识别控件
closeScan() {
if (!window.plus) return
scan.close()
}
},
mounted() {
this.startRecognize();
},
beforeDestroy(){
// 清除扫描
this.closeScan();
}
}
</script>
1 个回复
4***@qq.com (作者)
貌似都没人回答问题啊?