mui 框架 引進子頁面和預加載

頁面初始化 mui.plusReady(function(){ console.log("當前頁面URL:"+plus.webview.currentWebview().getURL()); }); 2.在一個頁面中 鏈接首頁 與其餘頁面的跳轉連接 用到加載(引入子頁)和預加載 其中 a1 a2 a3 a4 爲本身給各個子頁面取的id名 其中 home con app 等爲下面菜單對應的應用用來點擊獲取用html

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();
})
})web

相關文章
相關標籤/搜索