Browse Source

feat(student): 学生端作业列表支持下拉刷新

- 添加 onPullDownRefresh 方法实现下拉刷新功能
- 优化 loadData 方法,重置分页数据和表格列表
- 修改 getList 方法,使用 concat 将新数据追加到表格列表中
master
liutong 1 year ago
parent
commit
9d062542b7
  1. 20
      pages/student/index/job_list.vue

20
pages/student/index/job_list.vue

@ -67,6 +67,12 @@ import memberApi from '@/api/member.js';
}, },
onShow(){ onShow(){
this.init()// this.init()//
},
//
async onPullDownRefresh() {
//
await this.loadData()
await this.getList()
}, },
methods: { methods: {
// //
@ -83,11 +89,16 @@ import memberApi from '@/api/member.js';
} }
}, },
// //
loadData() { async loadData() {
setTimeout(() => {
this.isReachedBottom = false; // 便 this.isReachedBottom = false; // 便
}, 1000);
this.filteredData.page = 1//
this.filteredData.limit = 10//
this.filteredData.total = 10//
this.tableList = []
}, },
// //
async getList(){ async getList(){
this.loading = true this.loading = true
@ -114,7 +125,8 @@ import memberApi from '@/api/member.js';
return return
} }
this.tableList = res.data.data this.tableList = this.tableList.concat(res.data.data); // 使 concat
console.log('列表',this.tableList) console.log('列表',this.tableList)
this.filteredData.total = res.data.total this.filteredData.total = res.data.total
this.filteredData.page++ this.filteredData.page++

Loading…
Cancel
Save