vue里无限滚动加载
v-infinite-scroll=“loadMore”infinite-scroll-disabled=“loading”infinite-scroll-distance=“10”loading:false,loadMore() {this.loading = true;this.pages++if(this.myl == true){return}else{setTim...
·
v-infinite-scroll=“loadMore”
infinite-scroll-disabled=“loading”
infinite-scroll-distance=“10”
loading:false,
loadMore() {
this.loading = true;
this.pages++
if(this.myl == true){
return
}else{
setTimeout(() => {
this.$axios({
method:"get",
url:this.api+"hairdressing/Goods/discuss",
params:{
designerid:this.$route.params.indexj,
page:this.pages,
limit:this.limit,
}
}).then((res)=>{
if(res.data.status==1){
if(res.data.result.list.length>0){
res.data.result.list.forEach(res=>{
this.cardpj.push(res)
})
this.cardpj.forEach(items => {
items.design_score = parseFloat(items.design_score)
});
this.cardpj.forEach(itemss => {
if(itemss.comment.length<20){
this.gd = ""
}
});
this.cardpj.forEach(items => {
items.pic = items.pic.split(",")
});
console.log(this.cardpj)
}else{
this.myl = true
return false
}
}else{
this.myl = true
return false
}
});
this.loading = false;
}, 1500);
}
},
判断是否执行无限滚动加载
把滚动加载出来的数据向之前的循环cardpj里添加
没有数据时关闭加载 显示没有更多数据了
更多推荐
已为社区贡献50条内容
所有评论(0)