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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM