@pullingdown="onpullingdown"
@click="reFresh"
>
<view class="loading-more-down">
<image v-if="refreshText=='3'" style="width: 108rpx;height:24rpx;" src="@/static/load-list.gif"></image>
<view v-if="refreshText=='2' || refreshText=='1'" style="width: 108rpx;height:24rpx;">
<image style="width: 108rpx;height:24rpx;" src="@/static/load-list.png"></image>
</view>
</view>
</refresh>
</cell>
<cell v-for="(item,index) in list" key="item.resumeId"
ref="'cell'+index">
<resumeItem :info="item" :url="'/pages/resume/detail/detail?id=' + item.resumeId"/>
</cell>
<cell v-if="list.length > 6">
<view class="loading-more">
<image v-if="!noData" style="width: 108rpx;height:24rpx;" src="@/static/load-list.gif"></image>
<text :class="list.length > 6 && noData?'loading-more-text-accomplish':'loading-more-text'">{{list.length > 6 && noData?'- THE END -':''}}</text>
</view>
</cell>
</list>
</view>
<script>
methods: {
//下拉操作
onpullingdown(e){
//当正在刷新的时候直接返回
if(this.refreshing){
return;
}
if (Math.abs(e.pullingDistance) > 60) {
//当下拉的距离大于fresh组件的高度
this.refreshText = "1";
} else {
this.refreshText = "2";
}
},
//释放加载
onrefresh(){
if(this.loading){
//当正在调用接口获取数据时,此时的下拉不做任何操作
return;
}
this.refreshText="3";
//刷新数据
//模拟接口延迟
this.loading = true;
this.refreshing = true;
this.params.pageNum = 1
this.loadHotList()
},
//触底加载
loadMore(){
if (this.count <= this.list.length) {
this.$store.commit('home/setNoData', true)
return
}
this.loadHotList()
},
//加载列表
async loadHotList() {
const {
data,
count,
success
} = await this.loadApi()//列表数据
if(success){
const curList = data;
this.count = count
if (this.params.pageNum === 1) {
this.list = [];
}
this.params.pageNum += 1
this.list = this.list.concat(curList); // 追加新数据
this.resetLoadmore()
this.getUserRoleNew = false
if(this.list.length){
if(this.count <= this.list.length){
this.$store.commit('home/setNoData', true)
}else{
this.$store.commit('home/setNoData', false)
}
this.noShow = false
this.loading = false;
this.refreshing = false;
this.refreshText="";
this.loadErr = false;
}else{
this.loading = false;
this.refreshing = false;
this.refreshText="";
this.loadErr = false;
}
}
},
// 重置 loadmore
resetLoadmore() {
this.$refs["list"].resetLoadmore();
},
}
</script>