• 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;
          });
        },
     

    原文链接: cnblogs.com/lvlvlv/p/11543575.html

  • 相关阅读:
    【Leetcode周赛】从contest-81开始。(一般是10个contest写一篇文章)
    【LeetCode】抽样 sampling(共4题)
    【LeetCode】拓扑排序 topological-sort(共5题)
    【LeetCode】几何学 geometry(共2题)
    【读书笔记】C/C++程序员面试秘籍
    【读书笔记】程序员面试笔记
    【sql】牛客网练习题 (共 61 题)
    HDU 6119 小小粉丝度度熊 双指针
    2017多校第7场 HDU 6128 Inverse of sum 推公式或者二次剩余
    2017多校第7场 HDU 6121 Build a tree K叉树,思维
  • 原文地址:https://www.cnblogs.com/mp-0518/p/11956051.html
Copyright © 2020-2023  润新知