index、a、b、c 四个页面
//index打开 a 为index
<html>
<head><title>index页</title> </head>
<body>
<div class="li">go-aa</div>
</body>
</html>
<script>
mui.init();
mui.plusReady(function() {
mui("body").on("tap",".li",index)
function indexclick(){
mui.openWindow({
url:'a.html',
id:'a'
});
}
})
</script>
//a打开 b 为A //会员中心
<html>
<head><title>a页</title> </head>
<body>
<div class="li">go-bb</div>
</body>
</html>
<script>
mui.init();
mui.plusReady(function() {
mui("body").on("tap",".li",index)
function indexclick(){
mui.openWindow({
url:'b.html',
id:'b'
});
}
})
</script>
//b打开 c 为B页面 // 找回密码
在B页面中 :
<html>
<head><title>b找回密码</title> </head>
<body>
<div class="li">go-cc</div>
</body>
</html>
<script>
mui.init();
mui.plusReady(function() {
mui("body").on("tap",".li",index)
function indexclick(){
var user_index=plus.webview.getWebviewById( "c");
if(user_index){
//alert("1") //窗口存在
user_index.reload();
user_index.show();
}else{
mui.openWindow({
url: "c.html",
id: "c",
createNew: false
})
}
}
})
</script>
在C页面中(登录) :
<html>
<head><title>c页登录</title> </head>
<body>
</body>
</html>
<script>
mui.init();
mui.plusReady(function() {
//在父页面=打开子页面关闭父页面-打开父父页面
var page = plus.webview.currentWebview().opener().id; //父类
if(page=='b'){
//b是指从 B页面的 id
plus.webview.currentWebview().opener().close(); //关闭 //父类
}else{
plus.webview.currentWebview().opener().reload();
}
//刷新父父页面
var primaryBack = mui.back;
mui.back = function() {
var wobj = plus.webview.getWebviewById("a"); //指A页面的id
wobj.reload(true);
primaryBack();
}
})
</script>
2 个评论
要回复文章请先登录或注册
太2真人
Derekwong