Vue+iview===>>>真假分页功能的实现

6 篇文章 0 订阅
<Table 
          :columns="columns_first" 
          :data="userpage" 
          border
          highlight-row
          :loading="ifLoading"
          @on-current-change="handleCurrentRowthree"
          @on-selection-change="selectionChange">
				</Table>

<Page  
          :total="totalNum" 
          :current="currentPageIdx"   
          @on-change="changePage" 
          show-elevator></Page>


//data
filterSearch: {
        pageNo: 1,
        pageSize: 10,
        memberId:"",
        symbol:"",
        exchangeName:"",
        positionSide:"",
        different:"",
      },
  currentPageIdx: 1,
  ifLoading: true,
  totalNum: null,
  columns_first: [
        {
          type: "selection",
          width: 60,
        },
        {
          title: "ID",
          key: "id",
          width: 90,
        },
        {
          title: "会员ID",
          key: "memberId",
          width: 80,
        },
      ],
userpage: [],
historyData:[],// 初始化信息总条数

真分页js

refreshPage(obj = {}) {
      this.ifLoading = true;
      bicmcoin(obj).then((res) => {
        if (!res.code) {
          this.ifLoading = false;
          this.userpage = res.data.content;
          console.log(res, "res");
          this.totalNum = res.data.totalElements;
        } else this.$Message.error(res.message);
      });
    },
    changePage(pageIndex) {
      this.currentPageIdx = pageIndex;
      this.filterSearch.pageNo = pageIndex;
      this.refreshPage(this.filterSearch);
    },

假分页js

refreshPage(obj = {}) {
      this.ifLoading = false;
        this.ifLoading = true;
        bicmcoin(obj).then((res) => {
          if (!res.code) {
            this.ifLoading = false;
            this.historyData = res.data;
            this.totalNum = res.data.length;
            if(this.totalNum<this.filterSearch.pageSize){
              this.userpage = this.historyData;
            } else {
              this.userpage = this.historyData.slice(0, this.filterSearch.pageSize);
            }
          } else this.$Message.error(res.message);
        });
    },
    changePage(index) {
      var _start = (index - 1) * this.filterSearch.pageSize;
      var _end = index * this.filterSearch.pageSize;
      this.userpage = this.historyData.slice(_start, _end);
    },
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值