1***@qq.com
1***@qq.com
  • 发布:2019-12-10 17:26
  • 更新:2019-12-10 17:26
  • 阅读:2784

扫码黑屏

分类:HTML5+

扫码黑屏这个问题一直在华为和小米等手机不定时出现。

1、先解决办法如下。在退出的时候释放扫码对象并关闭

     mui.init({  
                beforeback: function() {  
                    //返回true继续页面关闭逻辑  
                    if(scan != null) {  
                        scan.close()  
                        scan = null;  
                    }  
                    return true;  
                }  
     })

2、没有使用demo的用法,这里在mui.plusReady中使用setTimeOut 300之后初始化扫码

            var scan=null;  
            mui.plusReady(function() {  
                setTimeout("scanInit()", 300)  
            })  

            function scanInit() {  
                var filter = [plus.barcode.CODE128];  
                scan = new plus.barcode.Barcode('bcid', filter);  
                scan.onmarked = onmarked;  
                scan.onerror = onerror;  
                scan.start();  
            }

以上用了之后确实没有出现过黑屏

0 关注 分享

要回复文章请先登录注册