欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ant-design-vue中設(shè)置Table每頁(yè)顯示的條目數(shù)量方式

 更新時(shí)間:2022年10月20日 15:05:02   作者:黃安樹(shù)_  
這篇文章主要介紹了ant-design-vue中設(shè)置Table每頁(yè)顯示的條目數(shù)量方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

ant-design-vue設(shè)置Table每頁(yè)顯示的條目數(shù)量

新項(xiàng)目中設(shè)置分頁(yè)條數(shù)遇到點(diǎn)問(wèn)題,查閱百度發(fā)現(xiàn)都是使用:

pagination="false"禁用table的分頁(yè)功能,自己重新封裝一個(gè)分頁(yè),其實(shí)duck不必這么做,官方文檔中提供了一個(gè)pageSize,自然有自己的妙用!

?<a-table :columns="columns" :data-source="data" bordered ?:pagination="{ pageSize: 12 }"></a-table>
//pageSize為每頁(yè)顯示的條數(shù)

這樣,我們就輕輕松松的實(shí)現(xiàn)了限值頁(yè)面條數(shù)的功能~ 

ant-design-vue a-table的分頁(yè)

<a-table
        :columns="columns"       //列
        :dataSource="tableDatas"  //數(shù)據(jù)
        :loading="loading"
        :pagination="pagination"  //分頁(yè)屬性
        @change="handleTableChange"http://點(diǎn)擊分頁(yè)中數(shù)字時(shí)觸發(fā)的方法
        :rowKey="tableDatas => tableDatas.id"    //每一行的標(biāo)識(shí)
      >
        <span slot="action" slot-scope="text, record">  //放表格中操作的按鈕
          <div class="tabBtn" >
            <a-popover placement="bottomRight" overlayClassName="tableBtn">
              <template slot="title">
                <a href="javascript:;" rel="external nofollow"  rel="external nofollow"  @click="handleAdd(record)" >
                  <i class="iconfont icon-table-edit" />編輯
                </a>
                <a href="javascript:;" rel="external nofollow"  rel="external nofollow"  @click="deleHostData(record)">
                  <i class="iconfont icon-tableEmpty" />刪除
                </a>
              </template>
              <span>
                <i class="iconfont icon-tableMore" />
              </span>
            </a-popover>
          </div>
        </span>
      </a-table>
//data中的數(shù)據(jù)data() {
    return {
      pagination: {
        total: 0,
        pageSize: 10,//每頁(yè)中顯示10條數(shù)據(jù)
        showSizeChanger: true,
        pageSizeOptions: ["10", "20", "50", "100"],//每頁(yè)中顯示的數(shù)據(jù)
        showTotal: total => `共有 ${total} 條數(shù)據(jù)`,  //分頁(yè)中顯示總的數(shù)據(jù)
      },
 
      loading: true,
      // 查詢(xún)參數(shù)
      queryParam: {
        page: 1,//第幾頁(yè)
        size: 10,//每頁(yè)中顯示數(shù)據(jù)的條數(shù)
        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();
    },//調(diào)用查詢(xún)接口為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;
      });
    },

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論