解决办法:
原因是因为:当你调用onload方法重新加载的时候,需要打开finished为false,但是触发条件是需要滑动界面,所以加了条件之后没有加载出数据,需要滑动界面
调用方法:
this.paramValue.pageNum = 1
this.projects = []
this.finished = false
this.onLoad()
onload方法:
起作用的代码块:
onLoad() {
if (this.inLoadingProcess) {
return
}
this.inLoadingProcess = true
getPageProjects(this.paramValue).then((res) => {
this.inLoadingProcess = false
if (res.data.records.length > 0) {
// 加载状态结束
this.loading = true
this.changeResData(res.data.records)
const data = res.data.records
if (this.paramValue.pageNum === 1) {
this.projects = data
} else {
this.projects = this.projects.concat(data)
}
// 加载状态结束
this.loading = false
this.paramValue.pageNum++
this.show = true
// 判断已经加到最后一页
if (data.length === 0 || data.length < 7) {
// 加载完成
this.finished = true
}
} else {
this.loading = false
// 加载完成
this.finished = true
}
})
},