<script type="text/javascript">
mui.init();
var targetPage = mui.preload({
url:'sub.html',
id:'sub'
});
mui.plusReady(function () {
mui('.mui-table-view').on('tap','a',function(){
// mui.alert(this.innerHTML);
// alert(this.getAttribute('id'));
mui.fire(targetPage,'newsId',{
title:this.innerHTML,
id:this.getAttribute('id')
});
mui.openWindow({
url:'sub.html',
id:'sub'
});
});
})
</script>
<script type="text/javascript">
mui.init();
window.addEventListener('newsId',function(event){
//获得事件参数
var id = event.detail.id;
//根据id向服务器请求新闻详情
mui.toast(id);
});
</script>
到子页面时没反应,是fire事件没被触发吗?哪里代码有问题?
0 个回复