局部滚动触底加载

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_class">全部课程</p>
<div class="card_list" v-if="classList.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 classList" :key="item.id" @click="handleToDetail(item.id)">
<div class="card_left">
<img :src="item.pictureUrl" alt="">
@@ -48,17 +48,20 @@ export default {
}
}).then(res=> {
if(res?.data) {
this.classList = res.data.records
this.classList = this.current==1? res.data.records: [...this.classList,...res.data.records]
}
})
},
handleToDetail(id) {
this.$emit('toDetail',id)
},
scrolltLower() {
this.current ++;
this.getList()
}
},
onReachBottom() {
this.current ++;
this.getList()
},
}
</script>