// 创建二维码窗口
createBarcode() {
let that = this;
let codeArr = [
plus.barcode.QR,
plus.barcode.CODE128
];
let top = 0;
if (uni.getSystemInfoSync().platform == "ios") {
top = (44+that.statusBarHeight)+'px';
}
barcode = plus.barcode.create('barcode',codeArr, {
top: top,
left: '0',
width: '100%',
height: that.height,
scanbarColor: '#E50073',
position: 'fixed',
frameColor: '#E50073',
},true);
barcode.onmarked = that.onmarked;
barcode.setFlash(that.flash);
currentWebview.append(barcode);
barcode.start();
},
createView(currentWebview) {
// 创建打开手电筒的按钮
let clseIcon = '/static/lightclose.png';
let openIcon = '/static/lightopen.png';
let iconObj = [{
tag: 'img',
id: 'scanBar',
src: clseIcon,
position: {
width: '28px',
left: '36%',
height: '28px'
}
}];
scanBarVew = new plus.nativeObj.View('scanBarVew', {
top: 40 + 'px',
left: '80%',
width: '36px',
height: '30px',
},
iconObj
);
scanBarVew.interceptTouchEvent(true);
currentWebview.append(scanBarVew);
let temp = this;
scanBarVew.addEventListener('click', function(e) {
//点击按钮点亮手电筒
temp.flash = !temp.flash;
iconObj.src = temp.flash ? openIcon : clseIcon;
scanBarVew.draw(iconObj);
if (barcode) {
barcode.setFlash(temp.flash);
}
}, false);
}
- 发布:2022-11-29 17:46
- 更新:2022-11-29 17:46
- 阅读:176
产品分类: HTML5+
HBuilderX版本号: 3.6.5
手机系统: iOS
手机系统版本号: iOS 16
手机厂商: 苹果
手机机型: iphone 14 Pro
打包方式: 云端
示例代码:
操作步骤:
正常扫码就行
正常扫码就行
预期结果:
ios能够和安卓一样正常识别条形码
ios能够和安卓一样正常识别条形码
实际结果:
ios不行够正常识别条形码
ios不行够正常识别条形码
bug描述:
业务场景:
我用barcode组件做识别QR二维码和CODE128条形码扫码界面,根据二维码和条形码识别内容来获取数据,安卓二维码和条形码都正常,ios识别二维码也可以,但是ios识别条形码的时候,同样的条形码,图片正常大小,安卓正常识别,但是ios,识别不了,需要将条形码放大2倍以上才能识别