详细问题描述
[内容]nativeObj在使用left:'auto'进行定位的时候,在安卓设备上会出现强制关闭的情况(多台设备,红米4,mate9,mix2s),ios上一切正常
重现步骤
[步骤]nativeObj在使用left:'auto'进行定位的时候,在安卓设备上会出现强制关闭的情况(多台设备,红米4,mate9,mix2s),ios上一切正常,详情见代码片段
[结果]android上崩溃
[期望]android定位正常,虽然我用了left:20%也实现了居中效果但这是权宜之计
运行环境
[系统版本] macos 版本 10.12 (915)
[浏览器版本]andriod打包后运行的浏览器
[IDE版本]HBuilder 9.0.2.201803061935
[mui版本]不实用mui
附件
[代码片段]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<link rel="stylesheet" href="css/qrscan.css" />
<style>
.qr-code {
top: 0;
left: 0;
position: absolute;
width: 100%;
height: 100%;
background-color: #000000;
}
</style>
</head>
<body style="padding: 0;margin: 0;">
<div id="scan" class="qr-code"></div>
</body>
<script type="text/javascript">
var bc = {}
document.addEventListener('plusready', function(){
//console.log("所有plus api都应该在此事件发生后调用,否则会出现plus is undefined。"
const id = 'scan'
const QRCode = [plus.barcode.QR];
const QRStyle = {frameColor:"#fffffe",scanbarColor:"#0086cd",background:""}
bc = new plus.barcode.Barcode( id, QRCode ,QRStyle);
bc.onmarked = onMarked;
bc.start();
createView();
});
function createView(){
var statusHeight = 20;
var headerHeight = 60;
var topView = new plus.nativeObj.View('header',{top:'0px',left:'0px',width:'100%',height:headerHeight+statusHeight+'px',backgroundColor:'#0086cd'});
var richHeader = '<div style="color: #ffffff;font-size:20px">扫一扫</div>'
topView.drawRichText(richHeader,{top:statusHeight + headerHeight/2-10+'px',left:'0px',width:'100%',height:'100%'},{align:'center'})
topView.show()
var view = new plus.nativeObj.View('scaner-notice', {top:'530px',left:'0px',height:'wrap-content',width:'100%',opacity:'0.5'});
var _text = "将二维码放入框内,即可自动扫描";
// 绘制文本
view.drawText(_text, {top:0,left:'auto',width:'60%',height:'wrap_content'}, {align:"center",whiteSpace:'normal',color:'#fff'});
view.show();
bc.start()
}
function onMarked(type,data){
alert(data)
setTimeout(function() {bc.start()}, 2000);
}
</script>
</html>
[安装包]
木有
联系方式
[QQ]463327701
[电话]
0 个回复