7***@qq.com
7***@qq.com
  • 发布:2018-02-22 15:41
  • 更新:2018-02-22 19:39
  • 阅读:888

请问怎么实现父页面不动,跳转非底部选项卡页面

分类:MUI

就是父页面index.html底部导航栏三个页面A,B,C

A可以通过自身页面按钮点击能跳到A1,A2

A1,A2包含父页面的底部导航栏即
A1+index=A1
A2+index=A2

2018-02-22 15:41 负责人:无 分享
已邀请:
7***@qq.com

7***@qq.com (作者)

自问自答,虽然很占内存
方法时是多开webview

1.添加A1为index.html的子页

  1. 为index.html注册跳转事件

    document.addEventListener('gohome1', function(event) {  
                //传入要跳转的参数页  
                targetTab= event.detail.tiao;  
                //跳转代码  
                if(targetTab==activeTab){  
            return;  
        }  
        //更换标题  
        //title.innerHTML = this.querySelector('.mui-tab-label').innerHTML;  
        //显示目标选项卡  
        plus.webview.show(targetTab);  
        //隐藏当前选项卡  
        plus.webview.hide(activeTab);  
        //更改活跃的选项卡  
        activeTab=targetTab;  
    
                //切换第一个选项卡按钮高亮  
                var defaultTab = document.getElementById("defaultTab");  
                //模拟首页点击  
                var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");  
                if (defaultTab !== current) {  
                    current.classList.remove('mui-active');  
                    defaultTab.classList.add('mui-active');  
                }  
            });
  2. 在子页A调用跳转至A1(如点击id为"comment"的按钮跳转A1)
    btn.addEventListener('tap',function () {
    //获得主页面的webview
    var main = plus.webview.currentWebview().parent();
    //触发主页面的gohome1事件
    mui.fire(main,"gohome1",{
    tiao:"A1.html"
    });
    });

该问题目前已经被锁定, 无法添加新回复