父页面: index.html
var detailPage = null;
//添加切换样式的点击事件
mui('.tab_layout').on('tap', 'a', function(e) {
$(this).toggleClass('show_list');
var id = this.getAttribute('test');
//获得列表子页面
if(!detailPage){
detailPage = plus.webview.getWebviewById('pullrefresh_sub.html');
}
//触发子页面页面的newsId事件
mui.fire(detailPage,'newsId',{
id:id
});
//打开子页面
});
子页面: pullrefresh_sub.html
window.addEventListener('newsId',function(event){
$('.searchListBox').toggleClass('openList');
//通过event.detail可获得传递过来的参数内容
});