一、初始化limit start
data() {
return {
...
total:10,
limit:8, // 一次加载八条数据
start:0,
goodsList:[]
};
}
拼串http请求
this.axios.get("/goods/list",{params:{start:this.start,limit:this.limit}}).then(res => {
this.list = res.data.result;
if(res.data.code==200){
this.goodsList = res.data.result;
this.total = Math.ceil(res.data.total/this.limit)*10;
}
});