<template>标签中:
<view class="" v-if="daShow==1">
<view class="orderlist-list" @click="goDetail(item.id)" v-for="item in row_list" :key='item.id'>
<!-- 此处渲染数据,不在此展示 -->
</view>
<view class="loading">{{loadingText}}</view>
</view>
<view class="sh_kong" v-if="daShow==2"><img class="sh_kong_img" src="../../static/images/empty_order.png" alt="">暂无内容哦!</view>
<script>
let timer = null
export default{
data(){
return{
loadingText:'加载更多',
page: 1,
}
},
//上拉加载
onReachBottom() {
var that = this;
if(timer != null){
clearTimeout(timer);
}
timer = setTimeout(function(){
//加载更多数据
that.getMorenews();
}, 1000);
},
methods:{
_getMemberList(){
var that = this
let data = {
token: this.$utils.getCache('Token'),
page: that.page,
bus_type: that.bus_type,//校内校外
longitude: longitude,
latitude: latitude,
}
this.$utils.ajaxpost(this.api.getMemberList, data, res => {
if(res.status==1){
that.row_list = res.data.rows
that.page++
if(res.data.rows.length!=0){
that.daShow = 1;
}else{
that.daShow = 2;
}
}
})
},
getMorenews(){
var that = this
that.loadingText = '加载中...';
//在当前页面显示导航条加载动画。
uni.showNavigationBarLoading();
let data = {
token: this.$utils.getCache('Token'),
page: this.page,
bus_type: this.bus_type,//校内校外
longitude: longitude,
latitude: latitude,
}
this.$utils.ajaxpost(this.api.getMemberList, data, res => {
if(res.data.rows.length == 0){
//在当前页面隐藏导航条加载动画。
that.loadingText = '没有更多数据了';
uni.hideNavigationBarLoading();
return false;
}
that.page++
var listeds = res.data.rows;
that.row_list = that.row_list.concat(listeds)
uni.hideNavigationBarLoading()
})
},
}
}
</script>