下拉刷新
//监听下拉刷新动作的执行方法,用户每手动下拉刷新都会执行有一次
onPullDownRefresh() {
setTimeout(function() {
uni.stopPullDownRefresh()
}, 1000)
},
上拉加载
import uniloadmore from '@/components/uni-load-more/uni-load-more.vue';
components: {
uniloadmore,
},
data(){
return{
page:1,
status: 'more',
contentText: {
contentrefresh: '加载中',
contentdown:'正在加载中',
contentnomore: '没有更多数据了'
}
}
}
onReachBottom() {
console.log('页面触底了')
let that = this;
this.status = 'loading'
uni.showNavigationBarLoading();
if(!that.isMore)
{
that.status = 'nomore';
uni.hideNavigationBarLoading();
//todo 无数据 不加载
return;
}
that.page++;
utils.request('/api/applet/jobs/list',{page:that.page,limit:that.limit},
function(res){
uni.hideNavigationBarLoading();
that.status = 'more';
if(res.data.data.length == 0){
that.isMore = false;
that.status = 'nomore';
}
for(let i=0;i<res.data.data.length;i++){
that.details.push(res.data.data[0])
}
},function(res){
},'Get')
},