一、初始化limit start

  1. data() {
  2. return {
  3. ...
  4. total:10,
  5. limit:8, // 一次加载八条数据
  6. start:0,
  7. goodsList:[]
  8. };
  9. }

拼串http请求

  1. this.axios.get("/goods/list",{params:{start:this.start,limit:this.limit}}).then(res => {
  2. this.list = res.data.result;
  3. if(res.data.code==200){
  4. this.goodsList = res.data.result;
  5. this.total = Math.ceil(res.data.total/this.limit)*10;
  6. }
  7. });