ant-design-vue中設(shè)置Table每頁(yè)顯示的條目數(shù)量方式
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)文章
Vue.js組件tab實(shí)現(xiàn)選項(xiàng)卡切換
這篇文章主要為大家詳細(xì)介紹了Vue.js組件tab實(shí)現(xiàn)選項(xiàng)卡切換的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03
vue點(diǎn)擊彈窗自動(dòng)觸發(fā)點(diǎn)擊事件的解決辦法(模擬場(chǎng)景)
本文通過(guò)案例場(chǎng)景給大家介紹vue點(diǎn)擊彈窗自動(dòng)觸發(fā)點(diǎn)擊事件的解決辦法,通過(guò)兩種方法給大家分享vue 自動(dòng)觸發(fā)點(diǎn)擊事件的處理方法,對(duì)vue自動(dòng)觸發(fā)點(diǎn)擊事件相關(guān)知識(shí)感興趣的朋友一起看看吧2021-05-05
sortable+element 實(shí)現(xiàn)表格行拖拽的方法示例
這篇文章主要介紹了sortable+element 實(shí)現(xiàn)表格行拖拽的方法示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-06-06
解決vue生產(chǎn)環(huán)境,頁(yè)面卡死的問(wèn)題
這篇文章主要介紹了解決vue生產(chǎn)環(huán)境,頁(yè)面卡死的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07
Vue+Element ui 根據(jù)后臺(tái)返回?cái)?shù)據(jù)設(shè)置動(dòng)態(tài)表頭操作
這篇文章主要介紹了Vue+Element ui 根據(jù)后臺(tái)返回?cái)?shù)據(jù)設(shè)置動(dòng)態(tài)表頭操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-09-09
Element基于el-input數(shù)字范圍輸入框的實(shí)現(xiàn)
本文主要介紹了?Element基于el-input數(shù)字范圍輸入框的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-04-04

