mui.init({
pullRefresh: {
container: '#pullrefresh', //待刷新区域标识,querySelector能定位的css选择器均可,比如:id、.class等
up: {
contentrefresh: "正在加载...", //可选,正在加载状态时,上拉加载控件上显示的标题内容
contentnomore: '没有更多数据了', //可选,请求完毕若没有更多数据时显示的提醒内容;
callback: add_more //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
}
},
});
function add_more() {
var pageNo = Zepto('#pageNo').val();
var pageCount = Zepto('#pageCount').val();
// if(pageNo>=pageCount){
// mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
// }
Zepto('#pageNo').val(parseInt(pageNo) + 1);
mui.ajax({
type: 'POST',
url: "list.do",//dataurl数据列表
data: 'pageNo=' + pageNo ,
success: function(json) {
var msg = eval(json);
if (msg.statusCode == 200) {
Zepto.each(msg.data, function(i, v) {
var btn='';
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //参数为true代表没有更多数据了。
} else {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //参数为true代表没有更多数据了。
}
}
});
}
//触发第一页
if (mui.os.plus) {
mui.plusReady(function() {
setTimeout(function() {
// mui('#pullrefresh').pullRefresh().refresh(true);
mui('#pullrefresh').pullRefresh().pullupLoading();
}, 1000);
});
}
else {
mui.ready(function() {
Zepto('#pageNo').val(1);
mui('#pullrefresh').pullRefresh().pullupLoading();
});
}
java
- 发布:2015-10-13 15:53
- 更新:2015-10-13 15:53
- 阅读:2020
0 个回复