我换了另一种通过preload方式加载就没有出现这种问题了,那个li 的a标签里面保存的还保持为空的状态
<ul id="list" class="mui-table-view mui-table-view-chevron">
<li class="mui-table-view-cell"><a href="" class="mui-navigate-right" >YY201504071640 </a>
</li>
<li class="mui-table-view-cell"><a href="" class="mui-navigate-right">YY201504071638 </a>
</li>
</ul>
var curId=null;
mui.init({
swipeBack: false,
pullRefresh: {
container: '#pullrefresh',
down: {
callback: pulldownRefresh
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
},preloadPages:[{
id:'yysq',
url:'yysq3.html'
}
]
});
var detailPage = null;
//添加列表项的点击事件
mui('#list').on('tap', 'a', function(e) {
var id = this.getAttribute('href');
//获得详情页面
if(!detailPage){
detailPage = plus.webview.getWebviewById('yysq');
}
alert(this.innerHTML);
//触发详情页面的newsId事件
mui.fire(detailPage,'newsId',{
id:this.innerHTML
});
//打开详情页面
mui.openWindow({
id:'yysq'
});
});
- window.addEventListener('newsId',function(event){
//获得事件参数
var id = event.detail.id;
//根据id向服务器请求新闻详情
alert(id);
});