doladola
doladola
  • 发布:2015-08-02 13:12
  • 更新:2015-08-03 12:59
  • 阅读:1992

新页面打开一直在加载状态,按下返回键再次点击才能打开

分类:MUI
mui.plusReady(function() {  
                alert('ready!')  
            });  
            document.getElementById('regist').addEventListener('tap', function() {  
                //打开关于页面  
                mui.openWindow({  
                    url: 'regist.html',  
                    id: 'regist'  
                });  
            });  

ready可弹出

报错Uncaught ReferenceError: plus is not defined

这是全部代码


<!DOCTYPE html>  
<html>  
<head>  
<meta charset="utf-8">  
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />  
<title></title>  
<link href="../../Public/Common/mui/css/mui.min.css" rel="stylesheet" />  
</head>  
<body>  
<section>  
<div class="login-wrap">  
<img src="../../Public/Common/images/logo.png" />  
<form id='login-form' class="mui-input-group">  
<div class="mui-input-row">  
<label>账号</label>  
<input id='account' type="text" class="mui-input-clear mui-input" placeholder="请输入账号">  
</div>  
<div class="mui-input-row">  
<label>密码</label>  
<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入密码">  
</div>  
<button id="regist">注册</button>  
<button>登录</button>  
<button>忘记密码</button>  
<div class="fastlogin">  
<button>QQ</button>  
<button>Wechat</button>  
</div>  
</form>  
</div>  
</section>  
        <script src="../../Public/Common/mui/js/mui.min.js"></script>  
        <script>  
            mui.init();  
            mui.plusReady(function() {  
                alert('ready!')  
            });  
            document.getElementById('regist').addEventListener('tap', function() {  
                //打开关于页面  
                mui.openWindow({  
                    url: 'regist.html',  
                    id: 'regist'  
                });  
            });  
             //首页返回键处理  
             //处理逻辑:1秒内,连续两次按返回键,则退出应用;  
            var first = null;  
            mui.back = function() {  
                //首次按键,提示‘再按一次退出应用’  
                if (!first) {  
                    first = new Date().getTime();  
                    mui.toast('再按一次退出应用');  
                    setTimeout(function() {  
                        first = null;  
                    }, 1000);  
                } else {  
                    if (new Date().getTime() - first < 1000) {  
                        plus.runtime.quit();  
                    }  
                }  
            };  
        </script>  
</body>  

</html>  
2015-08-02 13:12 分享
已邀请:
五块钱的果汁

五块钱的果汁

建议开发之前先看一下 MUI开发注意事项 ,button如果不添加type="button"属性会默认按照type=submit逻辑处理,所以你点击的时候会"提交"页面造成刷新,导致报 plus is not defined

要回复问题请先登录注册