在list页面预加载详细内容页,然后通过自定义事件触发,但是详细页面会多次触发事件
list.html 页面代码如下
mui.preload({
id:"project_detail",
url:"../detail/pjdetail.html"
});
var detailPage = null;
if (!detailPage) {
detailPage = plus.webview.getWebviewById("project_detail");
}
mui.fire(detailPage, 'loadDetail',{
id:id
});
detailPage.show("slide-in-right", 300);
详细页面代码如下
function onPlusReady() {
document.addEventListener('loadDetail', function(e) {
console.log("project detail page is fired loadDetail and the id is " + e.detail.id);
});
}
if (window.plus) {
onPlusReady();
} else {
document.addEventListener('plusready', onPlusReady, false);
}
哥来自火星 (作者)
我试过了,第一,详细页面能够显示,document和window添加事件效果一样
2015-10-16 17:32