3***@qq.com
3***@qq.com
  • 发布:2019-01-19 14:15
  • 更新:2019-01-19 14:15
  • 阅读:1078

mui底部tab切换, 安卓点击home键返回第一次不会弹出confirm,第二次才可以,第一次会把最后一个subpages删除掉,再次点击index的时候就切换不过去了,这个什么问题?

分类:HTML5+
//tab子页切换  
    function changeView(id) {  
        var view = plus.webview.getWebviewById(id);  
        view.show();  
    }  
    mui.init({  
        subpages: [{  
                url: 'index/taskCenter.html',  
                id: 'index/taskCenter.html',  
                styles: {  
                    top: '0',  
                    bottom: fHeight,  
                    //bounce:"vertical"  
                }  
            },  
            {  
                url: 'index/rankingList.html',  
                id: 'index/rankingList.html',  
                styles: {  
                    top: '0',  
                    bottom: fHeight,  
                    //bounce:"vertical"  
                }  
            },  
            {  
                url: 'index/personalCenter.html',  
                id: 'index/personalCenter.html',  
                styles: {  
                    top: '0',  
                    bottom: fHeight,  
                    //bounce:"vertical"  
                }  
            },  
            {  
                url: 'index/index.html',  
                id: 'index/index.html',  
                styles: {  
                    top: '0',  
                    bottom: fHeight,  
                    //bounce:"vertical"  
                }  
            }  
        ]  
    });  

    mui.plusReady(function() {  
        //APP内部返回键  
        mui.back = function(event) {  
            var btnArray = ['是', '否'];  
            mui.confirm('是否退出应用', '', btnArray, function(e) {  
                if(e.index == 0) {  
                    plus.runtime.quit();  
                }  
            });  
            return false;  
        }  
        var index = plus.webview.getWebviewById('index/index.html');  
        if(index) {  
            index.show();  
        }  

        document.getElementById('tab1').addEventListener('tap', function() {  
            changeView('index/index.html');  
        });  
        document.getElementById('tab2').addEventListener('tap', function() {  
            changeView('index/taskCenter.html');  
        });  
        document.getElementById('tab3').addEventListener('tap', function() {  
            changeView('index/rankingList.html');  
        });  
        document.getElementById('tab4').addEventListener('tap', function() {  
            changeView('index/personalCenter.html');  
        });  
    });
2019-01-19 14:15 负责人:无 分享
已邀请:

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