1-在使用vant 的lise 上拉加载的时候,页面进入不触发unload事件
2-上拉加载的父盒子没有设置高度
3- html结构如下
<div class="item-box">
<van-list v-model="loading" :finished="finished" finished-text="暂无更多数据" @load="onLoad">
<div class="item disFlex flexCenter " v-for="item in institutionData " :key=item.id @click="goInside(item.id)">
<div class="left-pic">
<img :src="baseImgUrl + item.image" alt="">
</div>
<div class="right-text">
<p class="title">{{ item.shortname}}</p>
<p class="title-s">{{ item.name}}</p>
</div>
</div>
</van-list>
</div>
4- js数据
data数据
loading: false,
finished: false,
methods函数
onLoad () {
var that = this
setTimeout(() => {
this.$axios(
this.httpInstitutionUrl + this.afterurl.institutionList,
this.params
, 'post'
).then((res) => {
that.loading = false; //加载参数
if (res.data.code == 200) {
let data = this.institutionData
data.push(...res.data.data)
that.institutionData = data
if (res.data.data.length == 10) { //分页数为10
that.page = that.page + 1;
} else {
that.finished = true;
}
} else {
that.finished = true; //设置加载参数
that.loading = false
}
}).catch((err) => {
console.log(err, '出错了');
})
}, 500);
},
因为父盒子添加了 overflow:scroll 所以导致不触发
删除就好了