目前我是ajax请求到数据后用js拼接列表,部分参数直接用自定义属性保存传参时读取属性值,
但是参数如果太多了怎么办?
另外觉得官方例子太少,没得一个完整的案例。
我的实例代码:
mui.post(cfg.hot_read, {startIndex:1, rows:2}, function(res){
if(res.code == 2000 && res.data.data.length){
var hot_html = ''
mui.each(res.data.data, function(i, v){
hot_html += '<li class="mui-table-view-cell mui-media" data-id="'+v.newsId+'">'
+'<a href="javascript:void(0);">'
+'<img class="mui-media-object mui-pull-right " src="'+v.newsImg+'">'
+'<div class="mui-media-body">'
+v.newsTitle
+'<p class="mui-ellipsis"><label>阅:'+v.newsViewNo+'</label> <label>'+v.newsAddtime+'</label></p>'
+'</div>'
+'</a>'
+'</li>';
});
document.getElementById("hot_news_list").innerHTML = hot_html;
mui(".mui-table-view").on('tap','.mui-table-view-cell',function(){
var newsId = this.getAttribute("data-id");
mui.openWindow({
url:dir+'temp/news_detail.html',
id:'news_detail',
extras:{
newsId:newsId
}
});
})
}
});
0 个回复