var art=$(".add-more").prev().find(".content").data("list1");
我们一定要在ajax里面进行封装这样的data,要不然打死都找不到这样的东西的。。。。。。。。。。。。。。
function loadArticle(){
$("#newsDetail").hide();
if(page.pagination == null) {
page.pagination = {
sortBy: "create_time",
sortDirection: "desc",
currentPage: currentPage,
itemsPerPage:5
}
}
var filter = {};
filter.title = "";
page.call("/article/list", {filter: filter, pagination: page.pagination}, function(result) {
if(result.bfStatus == "ok") {
var list1=result.articleList;
var list2=result.pagination;
if(list1.length > 0 && (currentPage < list2.totalPage)) {
// 列表
var content = $(".cloneNews");
for(var i = 0; i < result.articleList.length; i++) {
var article = list1[i];
var row = $(".cloneTemplate").find(".content").clone(true);
row.data("article",article);
row.data("list1",list1);
row.find(".hotTitle").text(article.title);
row.find(".newsTime").text(article.createTime.replace(/^([^s]+).*$/,'$1').replace(/[^d]/g,'-'));
var url = page.config.actionUrl + "/article/fileDownload?Bitfin-Platform=" + page.config.platform +
"&Bitfin-Version=" + page.config.version +
"&Bitfin-Token=" + page.user.token +
"&id=" + article.thumbnailFileId;
row.find(".pic-upload").attr("src",url);
content.append(row);
row.data("id",article.id);//添加id值
row.click(onLoadNewsDetail);
}
}else{
$(".add-more").text("文章全部加载完毕")
}
}
});
}