局部滚动触底加载
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user