|
楼主 |
发表于 2016-4-7 17:29:37
|
显示全部楼层
//以下代码,我ldata和list的limit分别都设置了2.但是为什么加载的时候执行了2次,之后不能向上加载了,为什么?所以只能显示4条数据,还有2条是看不到的。我用的是data不是bassdata
Model.prototype.topic_list_dataCustomRefresh = function(event) {
var jsonString = '{"@type":"table","rows":[' + '{"imgSrc":"' + img1 + '","title":"' + title1 + '","newsInfo":"' + news_info1 + '","talkNum":"' + talk_num1 + '","classTips":"' + on_tips
+ '"},' + '{"imgSrc":"' + img2 + '","title":"' + title2 + '","newsInfo":"' + news_info2 + '","talkNum":"' + talk_num2 + '","classTips":"' + no_tips + '"}'
+ '],"userdata":{"sys.count":"6"}}';
var jsonString1 = '{"@type":"table","rows":[' + '{"imgSrc":"' + img3 + '","title":"' + title3 + '","newsInfo":"' + news_info3 + '","talkNum":"' + talk_num3 + '","classTips":"' + on_tips
+ '"},' + '{"imgSrc":"' + img4 + '","title":"' + title4 + '","newsInfo":"' + news_info4 + '","talkNum":"' + talk_num4 + '","classTips":"' + on_tips + '"}' + ']}';
var jsonString2 = '{"@type":"table","rows":[' + '{"imgSrc":"' + img5 + '","title":"' + title5 + '","newsInfo":"' + news_info5 + '","talkNum":"' + talk_num5 + '","classTips":"' + no_tips
+ '"},' + '{"imgSrc":"' + img6 + '","title":"' + title6 + '","newsInfo":"' + news_info6 + '","talkNum":"' + talk_num6 + '","classTips":"' + on_tips + '"}' + ']}';
console.log(event.offset);//执行了2次,第一次打印0.第二次打印2.
if (event.offset === 0) {
var jsonObj1 = JSON.parse(jsonString);
this.comp("topic_list_data").loadData(jsonObj1, false);
} else if (event.offset === 2) {
var jsonObj2 = JSON.parse(jsonString1);
this.comp("topic_list_data").loadData(jsonObj2, true);
} else {
var jsonObj3 = JSON.parse(jsonString2);
this.comp("topic_list_data").loadData(jsonObj3, true);
}
};
|
|