设为首页 加入收藏

TOP

pc端vue 滚动到底部翻页(二)
2019-09-17 17:04:32 】 浏览:47
Tags:vue 滚动 底部
的高度 等于或者大于滚动条的总高度就是到达底部
this.deviceListIsLoad = true; console.log("到底了"); setTimeout(() => { this._deviceListPage(); }, 1000); } }

请求列表的处理

 _deviceListPage() {
      let params = {
        pageSize: this.devicePageSize,
        pageNum: this.devicePageNum,
        kw: "", //查询条件(通配查询条件)
        type: this.deviceType, //设备类型(下拉)2.1.6接口获取
        code: this.deviceCode, //设备编号
        areaId: this.deviceareaId, //位置区域
        status: this.deviceStatus, //状态 1:在线(正常),0:未激活,2已离线,3.告警
        imei: "" //imei编号
      };
      deviceListPage(params).then(res => {
        if (res.code == 200) {
          this.devicePageTotal = res.body.total;
          this.devicePageSize = res.body.pageSize;
          this.devicePageNum = res.body.pageNum;
          this.devicePageTotalPages = parseInt(
            (this.devicePageTotal + this.devicePageSize - 1) /
              this.devicePageSize
          );
          if (this.devicePageTotal == 0) {
            // console.log("没有数据");
            //没有数据
            this.deviceListnodata = true;
            this.deviceListIsLoad = false;
            this.deviceListIsFinish = true;
            this.devicePageNum = 1;
            this.deviceTip = "暂无数据";
            return false;
          }
          this.deviceList = this.deviceList.concat(res.body.datas);
          // console.log(this.devicePageNum, this.devicePageTotalPages);
          if (this.devicePageNum == this.devicePageTotalPages) {
            //没有更多
            this.deviceListIsLoad = false;
            this.deviceListIsFinish = true;
            this.devicePageNum = 1;
            this.deviceTip = "没有更多了~";
            // console.log("没有更多了");
          } else {
            // console.log("下一页");
            //下一页
            this.deviceListIsLoad = true;
            this.deviceListIsFinish = false;
            this.devicePageNum++;
            this.deviceTip = "正在加载中~";
          }
          // console.log("deviceList", this.deviceList);
        } else {
          // this.deviceList = [];
          this.deviceListIsLoad = false;
          this.deviceListIsFinish = true;
          this.devicePageNum = 1;
          this.deviceTip = "数据加载失败~";
        }
      });
    },

return中的定义

devicePageSize: 10, //每页显示
      devicePageNum: 1, //当前页
      devicePageTotal: 0, //总条数
      devicePageTotalPages: 0, //总页数
      deviceListIsFinish: false, //是否加载完成
      deviceListIsLoad: false, //是否加载更多
      deviceListnodata: false, //是否有数据
      deviceTip: "",

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇JavaScript学习笔记 下一篇手写Ajax的意义所在,从青铜到钻..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目