局部滚动触底加载

This commit is contained in:
shijingjing
2023-02-21 11:46:59 +08:00
parent 653d90b266
commit e879ea68d8
3 changed files with 29 additions and 16 deletions

View File

@@ -7,7 +7,7 @@
<p class="all_test">全部考试</p>
<div class="card_list" v-if="testList.length">
<scroll-view :style="{height: height + 'px'}" scroll-y>
<scroll-view :style="{height: height + 'px'}" scroll-y @scrolltolower="scrolltLower">
<div class="card" v-for="item in testList" :key="item.id">
<div class="card_top">
<div class="card_title">{{ item.examinationName }}</div>
@@ -97,7 +97,7 @@ export default {
}
}).then(res=> {
if(res?.data) {
this.testList = res.data.records
this.testList = this.current==1? res.data.records: [...this.testList,...res.data.records]
}
})
},
@@ -153,12 +153,12 @@ export default {
this.showAuth = false
this.$u.toast(err.msg)
})
},
scrolltLower() {
this.current++
this.getList()
}
},
onReachBottom() {
this.current++;
this.getList()
},
}
</script>