3***@qq.com
3***@qq.com
  • 发布:2018-05-02 17:51
  • 更新:2018-05-03 15:07
  • 阅读:1688

mui 预加载选项卡点击,ios能正常显示页面,安卓点击选项卡不显示页面

分类:MUI

var subpages = ['html/home.html', 'html/information.html','html/diary_edit.html',"html/mall.html",'html/my.html'];
var subpage_style = {
top: '0px',
bottom: $(".mui-bar-tab").height()
};
var subpage_style2 = {
top: '0px',
bottom: $(".mui-bar-tab").height()
};
var my = new Vue({
el: "#tab_nav",
data: {
menuList: [],
dataDone: false,
curIndex: 0
},
methods: {

    }  
});  
//当前激活选项  
var activeTab = subpages[0];  
var curindex = 0;  
var aniShow = {};  

function IndexController() {  

}  
IndexController.prototype.init = function() {  
    my.menuList = model.getAllMenu();  
    my.dataDone = true;  
    //创建子页面,首个选项卡页面显示,其它均隐藏;  
    mui.plusReady(function() {  
        var self = plus.webview.currentWebview();  
        for(var i = subpages.length; i >=0; --i) {  
            var temp = {};  
            var sub = plus.webview.create(subpages[i], subpages[i], subpage_style2);  
            if(i > 0) {  

// sub.hide();
} else {
temp[subpages[i]] = "true";
mui.extend(aniShow, temp);
}
self.append(sub);
}
});
//选项卡点击事件
mui('.mui-bar-tab').on('tap', 'a', function(e) {
var index = this.getAttribute('index');
for(var i = 0; i < my.menuList.length; ++i) {
var temp = my.menuList[i];
if(index == i && temp.isChoose) {
return;
}
temp.isChoose = false;
}
curIndex = index;
var obj = my.menuList[index];
obj.isChoose = true;
var targetTab = subpages[index];
if(targetTab == activeTab) {
return;
}
curindex = index;
//更换标题
//显示目标选项卡
//若为iOS平台或非首次显示,则直接显示
if(mui.os.ios || aniShow[targetTab]) {
plus.webview.show(targetTab);
} else {
//否则,使用fade-in动画,且保存变量
var temp = {};
temp[targetTab] = "true";
mui.extend(aniShow, temp);
plus.webview.show(targetTab, "none", 0);
}

        //隐藏当前;  
        plus.webview.hide(activeTab);  
        //更改当前活跃的选项卡  
        activeTab = targetTab;  
    });  

        如果把 sub.hide();  注释掉,点击切换选项卡,安卓机没问题;  
        但是如果不注释掉,mui的下拉刷新安卓机下拉后显示的是预加载的view,ios都没问题的;  
        求大神解,万分感谢,万分感谢,万分感谢!!!!!  
2018-05-02 17:51 负责人:无 分享
已邀请:
hylong

hylong

上传个能重现问题的简单示例

3***@qq.com

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

已经解决了,不是mui的问题,是我用vue加载的时候,
做的适配,没加载出来,所以会显示view没显示;

原来是这样的:
document.documentElement.style.fontSize = document.documentElement.clientWidth / 750 * 100 + 'px';

加上这个就好了,安卓机完美显示;
window.onresize=function(){
document.documentElement.style.fontSize = document.documentElement.clientWidth / 750 * 100 + 'px';
}

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