ant-design-vue a-table的分页

<a-table
        :columns="columns"       //列
        :dataSource="tableDatas"  //数据
        :loading="loading"
        :pagination="pagination"  //分页属性
        @change="handleTableChange"//点击分页中数字时触发的方法
        :rowKey="tableDatas => tableDatas.id"    //每一行的标识
      >
        <span slot="action" slot-scope="text, record">  //放表格中操作的按钮
          <div class="tabBtn" >
            <a-popover placement="bottomRight" overlayClassName="tableBtn">
              <template slot="title">
                <a href="javascript:;" @click="handleAdd(record)" >
                  <i class="iconfont icon-table-edit" />编辑
                </a>
                <a href="javascript:;" @click="deleHostData(record)">
                  <i class="iconfont icon-tableEmpty" />删除
                </a>
              </template>
              <span>
                <i class="iconfont icon-tableMore" />
              </span>
            </a-popover>
          </div>
        </span>
      </a-table>
//data中的数据data() {
    return {
      pagination: {
        total: 0,
        pageSize: 10,//每页中显示10条数据
        showSizeChanger: true,
        pageSizeOptions: ["10", "20", "50", "100"],//每页中显示的数据
        showTotal: total => `共有 ${total} 条数据`,  //分页中显示总的数据
      },

      loading: true,
      // 查询参数
      queryParam: {
        page: 1,//第几页
        size: 10,//每页中显示数据的条数
        hosName: "",
        hosCode: "",
        province: "",
        city: ""
      },
    };
handleTableChange(pagination) {
      this.pagination.current = pagination.current;
      this.pagination.pageSize = pagination.pageSize;
      this.queryParam.page = pagination.current;
      this.queryParam.size = pagination.pageSize;
      this.getTableList();
    },//调用查询接口为dataSource 赋值

    getTableList() {
      this.loading = true;
      retriveHosData(this.queryParam).then(res => {
        if (res.message === "SUCCESS") {
          const pagination = { ...this.pagination };
          pagination.total = res.data.total;
          this.tableDatas = res.data.list;
          this.pagination = pagination;
        }
        this.loading = false;
      });
    },

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值