作者:重庆垚东科技有限公司 | 来源:互联网 | 2023-10-17 10:44
html结构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
{{item.startDate | setDate }} {{item.respondents}} {{item.amtBorrow}}元
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| return {
caseList:[],
selected:0,
//分页属性
pageNo:"1",
pageSize:"10"
,
allLoaded: false, //是否可以上拉属性,false可以上拉,true为禁止上拉,就是不让往上划加载数据了
scrollMode:"auto" ,//移动端弹性滚动效果,touch为弹性滚动,auto是非弹性滚动
cjsImg:'',
caseStatus:'',
num:1,
allNum:''
} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| mounted(){
this.loadPageList();
},
//方法
loadPageList(){
this.$http.post('/case/list.htm',{
})
.then(respOnse=> {
let newData= JSON.parse(pako.inflate(response.data, { to: 'string' }));
this.caseList=newData.result;
this.isHaveMore(this.caseList);
console.log(newData)
for(let i=0;i this.$set(this.caseList[i],'show',false);
}
this.$nextTick(function () {
this.scrollMode = "touch";
});
}),
more(){
// 分页查询
this.num = parseInt(this.num) + 1;
this.$http.post('/case/list.htm',{
pageNo: this.num,
pageSize:10,
caseStatus:this.caseStatus
})
.then(respOnse=> {
let newData= JSON.parse(pako.inflate(response.data, { to: 'string' }));
this.caseList = this.caseList.concat(newData.result);
this.isHaveMore(this.caseList);
this.allNum=newData.count
if(this.allNum>newData.count){
this.allLoaded = true
}
}),
isHaveMore:function(isHaveMore){
// 是否还有下一页,如果没有就禁止上拉刷新
this.allLoaded = true; //true是禁止上拉加载
if(isHaveMore){
this.allLoaded = false;
}
}, |
这个是看别人博客写的,如何判断我只有5条数据,就拉不动了才对,但是还能在继续拉