mui 框架 引进子页面和预加载

页面初始化 mui.plusReady(function(){ console.log("当前页面URL:"+plus.webview.currentWebview().getURL()); }); 2.在一个页面中 连接首页 与其他页面的跳转链接 用到加载(引入子页)和预加载 其中 a1 a2 a3 a4 为自己给各个子页面取的id名 其中 home con app 等为下面菜单对应的应用用来点击获取用

mui.init({

subpages:[//先加载首页
{
url:'home.html',
id:'a1',
styles:{
top:'0px',
bottom:'50px'
}
}

],
preloadPages:[//缓存其他页面
{
url:'phone.html',
id:'a2',
styles:{
top:'0px',
bottom:'60px'
}
},
{
url:'app.html',
id:'a3',
styles:{
top:'0px',
bottom:'60px'
}
},
{
url:'mine.html',
id:'a4',
styles:{
top:'0px',
bottom:'60px'
}
}
]


});
mui.plusReady(function(){
var con=plus.webview.getWebviewById("a2");
var home=plus.webview.getWebviewById("a1");
var app=plus.webview.getWebviewById("a3");
var mine=plus.webview.getWebviewById("a4");
document.getElementById("home").addEventListener('tap',function(){
home.show();
con.hide();
app.hide();
mine.hide();

})
document.getElementById('con').addEventListener('tap',function(){
con.show();
})
document.getElementById('app').addEventListener('tap',function(){
app.show();
})
document.getElementById('mine').addEventListener('tap',function(){
mine.show();
})
})

原文地址:https://www.cnblogs.com/yaomengli/p/6774356.html