首页 > 其他 > 详细

mui中slider的上拉刷新下拉加载

时间:2019-09-27 17:27:26      阅读:175      评论:0      收藏:0      [点我收藏+]

var flag1 = false;
var flag2 = false;

var page1 = 1;
var page2 = 1;

 

$$.ready(function() {
//循环初始化所有下拉刷新,上拉加载。
$$.each(document.querySelectorAll(‘.mui-slider-group .mui-scroll‘), function(index, pullRefreshEl) {
//console.log(index)
$$(pullRefreshEl).pullToRefresh({
down: {
callback: function() {
var self = this;
if (index == 0) {
setTimeout(function() {
GetNoCompletEnterprise(1, 0);
self.endPullDownToRefresh(flag1);
self.refresh(true);
}, 500);
} else if (index == 1) {
setTimeout(function() {
GetCompletEnterprise(1, 0);
self.endPullDownToRefresh(flag2);
self.refresh(true);
}, 500);
}
}
},
up: {
auto: true,
contentnomore: ‘没有更多数据了‘,
callback: function() {
var self = this;
if (index == 0) {
setTimeout(function() {
GetNoCompletEnterprise(page1, 1);
self.endPullUpToRefresh(flag1);
}, 500);
} else if (index == 1) {
setTimeout(function() {
GetCompletEnterprise(page2, 1);
self.endPullUpToRefresh(flag2);
}, 500);
}
}

}
});
});

});

 

 

 

function GetCompletEnterprise(thepage, init) {
$.ajax({
type: "get",
contentType: "application/json;charset=utf-8",
url: ServerIp + ‘/api/rectify/rectificationEnterList‘,
data: {
page: thepage,
unit: localStorage.getItem(‘unitId‘),
state: 1,
enterprise: $(‘#search‘).val()
},
dataType: "json",
success: function(data) {
if (data != null && data != undefined) {
flag2 = data.length == 0 || data.length < 10;
if (flag2 == false) {
page2++;
}
mui(‘#item2mobile .mui-scroll‘).pullToRefresh().endPullUpToRefresh(flag2);
Bind_data(thepage, ‘#item2mobile .mui-scroll‘, data, init);
}
},
error: function(result, status) {

}
});
}

mui中slider的上拉刷新下拉加载

原文:https://www.cnblogs.com/yyjspace/p/11599195.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!