antd 表的分页道具 [英] pagination prop for antd table

查看:19
本文介绍了antd 表的分页道具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 antd 库中的 Table 组件.我想将分页道具传递给 Table 组件.在文档中,它说传递分页配置对象,该对象指的是分页组件本身.

I am using Table component from antd library. I want to pass pagination prop to the Table component. In the docs it says pass the pagination config object which refers to the Pagination component itself.

所以我使用分页组件道具名称作为键传递分页对象,例如<表格分页={{pageSizeOptions : ['30', '40'], showPageSizeOptions : true}} {...otherProps}/>

So I am passing the pagination object using Pagination component prop names as keys like <Table pagination={{pageSizeOptions : ['30', '40'], showPageSizeOptions : true}} {...otherProps} />

但是当我在 react-inspector 中检查 Table 组件时,我没有在组件 props 中看到分页道具,但它在组件状态中存在并且具有默认值.

But when I inspect the Table component in react-inspector I don't see the pagination prop in component props but it is there in the component state and has default values.

如何使用 Table 组件的分页属性?

How to use the pagination prop for Table component?

推荐答案

将showPageSizeOptions"替换为showSizeChanger".

Replace "showPageSizeOptions" to "showSizeChanger".

<Table pagination= { {pageSizeOptions: ['30', '40'], showSizeChanger: true}} rowSelection={rowSelection} columns={columns} dataSource={data} />

这篇关于antd 表的分页道具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆