var ws=null,wo=null;  
    var scan=null,domready=false;  
    // H5 plus事件处理  
    function plusReady(){  
        var height = window.innerHeight + 'px';//获取页面实际高度    
        var width = window.innerWidth + 'px';    
        document.getElementById("bcid").style.height = height;    
        document.getElementById("bcid").style.width = width;  
        if(ws||!window.plus||!domready){  
            return;  
        }  
        // 获取窗口对象  
        ws=plus.webview.currentWebview();  
        wo=ws.opener();  
        // 开始扫描  
        ws.addEventListener('show', function(){  
            scan=new plus.barcode.Barcode('bcid');  
            scan.onmarked=onmarked;  
            scan.start({conserve:true,filename:'_doc/barcode/'});  
        }, false);  
        // 显示页面并关闭等待框  
        ws.show('pop-in');  
    }  
    if(window.plus){  
        plusReady();  
    }else{  
        document.addEventListener('plusready', plusReady, false);  
    }  
    // 监听DOMContentLoaded事件  
    document.addEventListener('DOMContentLoaded', function(){  
        domready=true;  
        plusReady();  
    }, false);  
    // 二维码扫描成功  
    function onmarked(type, result, file){  
        switch(type){  
            case plus.barcode.QR:  
            type = 'QR';  
            break;  
            case plus.barcode.EAN13:  
            type = 'EAN13';  
            break;  
            case plus.barcode.EAN8:  
            type = 'EAN8';  
            break;  
            default:  
            type = '其它'+type;  
            break;  
        }  
        result = result.replace(/\n/g, '');  
        //如果扫描值不为空且为数字,储存扫描结果,跳转diancai.html  
//      alert("扫描结果为:" + result + ",非数字:" + isNaN(result));  
        if(result != null && isNaN(result)){  
            var btnArray = ['重新扫描'];  
            mui.confirm('请扫描正确的桌号!', '', btnArray, function(e)   
            {  
                plusReady();//此处从新调用扫描,但是无法进行扫描  
            })  
        } else{  
            localStorage.setItem("test",result);  
            mui.openWindow({  
                url:"diancai.html",  
                id:"diancan.html",  
//              }  
            });  
        }在扫描错误然后第二次调用plusReady();的时候黑屏或者无法进行扫描,不调用直接刷新本页面也不行,这是什么问题?
 
             
             
             
			 
                                        
                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
                                                                     
            
c***@chinahongke.com
你是对的
2020-08-06 16:41