document.getElementById('slider').addEventListener('slide', function(e) {
if (e.detail.slideNumber === 1) {
status = '0';
} else if (e.detail.slideNumber === 2) {
status = '4';
}else if (e.detail.slideNumber === 3) {
status = '3';
}else if (e.detail.slideNumber === 4) {
status = '2';
}else if (e.detail.slideNumber === 5) {
status = '5';
}else if (e.detail.slideNumber === 6) {
status = '6';
}else{
status = '1';
}
//循环初始化所有下拉刷新,上拉加载。
$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
if(e.detail.slideNumber == index){
$(this).pullToRefresh({
up: {
auto:true,//不能开启后果自负
contentrefresh: '正在加载...',
contentnomore:'别扯了,到底了',//可选,请求完毕若没有更多数据时显示的提醒内容;
callback: function() {
var self = this;
var ul = self.element.querySelector('.mui-table-view');
var length = ul.querySelectorAll('li').length;
$.post('index.php?c=taskData',{status:status,limit:0},function(res){
console.log(res)
res = eval('('+res+')');
var data = res.data;
arr = Object.keys(data);
var nomore = false;
if(arr.length == '0'){
nomore = true;
}
setTimeout(function() {
ul.appendChild(createFragment(ul, index, arr.length,data));
self.endPullUpToRefresh(nomore);
}, 1000);
})
}
}
});
}
})
});
7 个回复
apche
document.getElementById('slider').addEventListener('slide', function(e) {
//
}
});
DCloud_UNI_FXY
你可以结合tab-with-viewpagerindicator.html的代码。
可拖拽选项卡有slide事件的,你可以获知当前滑动切换到的选项卡index。根据该index来处理当前显示的选项卡的数据加载
dengzhenhua
楼主搞定了没有啊 我搞了很久都没有起色
偏执妮
楼主,搞定了没有啊,我知道怎么获取当前选项卡,但下拉刷新没有集成上去……有没有成功的案例呀
1***@qq.com
楼上看到联系qq:184866062,我的下拉刷新搞定,滑动选项卡不起作用了
Trust - 少说废话
请参看webview模式选项卡实现滑动切换
9***@qq.com
document.getElementById('slider').addEventListener('slide', function(e) {
if (e.detail.slideNumber === 1) {
status = '0';
} else if (e.detail.slideNumber === 2) {
status = '4';
}else if (e.detail.slideNumber === 3) {
status = '3';
}else if (e.detail.slideNumber === 4) {
status = '2';
}else if (e.detail.slideNumber === 5) {
status = '5';
}else if (e.detail.slideNumber === 6) {
status = '6';
}else{
status = '1';
}
//循环初始化所有下拉刷新,上拉加载。
$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
if(e.detail.slideNumber == index){
$(this).pullToRefresh({
up: {
auto:true,//不能开启后果自负
contentrefresh: '正在加载...',
contentnomore:'别扯了,到底了',//可选,请求完毕若没有更多数据时显示的提醒内容;
callback: function() {
var self = this;
var ul = self.element.querySelector('.mui-table-view');
var length = ul.querySelectorAll('li').length;
$.post('index.php?c=taskData',{status:status,limit:0},function(res){
console.log(res)
res = eval('('+res+')');
var data = res.data;
arr = Object.keys(data);
var nomore = false;
if(arr.length == '0'){
nomore = true;
}
setTimeout(function() {
ul.appendChild(createFragment(ul, index, arr.length,data));
self.endPullUpToRefresh(nomore);
}, 1000);
})
}
}
});
}
})
});