h5扫一扫是自己写个h5页面的不?用<web-view src="/hybrid/html/scanCode.html"></web-view>这样的?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="//js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.0.1.52.js"></script>
<script type="text/javascript">
var barcode = null;
var scanCode='';
// 扫码成功回调
function onmarked(type, result) {
var text = '未知: ';
switch (type) {
case plus.barcode.QR:
text = 'QR: ';
break;
}
alert(text + result);
scanCode=result;
}
// 创建扫码控件
function createBarcode() {
if (!barcode) {
barcode = plus.barcode.create('barcode', [plus.barcode.QR], {
top: '100px',
left: '0px',
width: '100%',
height: '500px',
position: 'static'
});
barcode.onmarked = onmarked;
plus.webview.currentWebview().append(barcode);
}
barcode.start();
}
document.addEventListener('UniAppJSBridgeReady', function() {
createBarcode();
uni.reLauch({
url: '/pages/tabbar/component/component?scanCode='+scanCode
})
});
</script>
<style type="text/css">
-
{
-webkit-user-select: none;
}html, body { margin: 0px; padding: 0px; height: 100%; } </style>
</head>
<body>
</body>
</html>
1 个回复
[已删除]
5+demo就有