【问题标题】:How to style antd Table pagination property in react js?如何在 React js 中设置 antd Table 分页属性的样式?
【发布时间】:2021-09-03 01:28:03
【问题描述】:

我正在使用 antd Table 来显示我的数据。所以在这里我添加了它的 pagination 属性,但它似乎没有正确对齐,所以我打算在其中添加 stlyes。

                          <Table
                            className="table product-overview"
                            columns={columns}
                            dataSource={dataSourceitems}
                            pagination={{className: "pagination", defaultPageSize: 5, showSizeChanger: true, pageSizeOptions: ['5','10']}}
                            responsive
                         >

在这里,通过该分页类,我可以添加样式,但我无法为里面的组件添加任何样式。因为实际上它看起来像 this 。请有人帮我提供一个基本风格,如thiss

【问题讨论】:

  • 在导入Table组件的文件中是否导入了antd样式? import 'antd/dist/antd.css'; index.js 在根中。
  • 还没有@ChrisSu

标签: css reactjs pagination styles antd


【解决方案1】:

antd组件的css样式与其组件是分开的,所以需要同时导入antd css文件,但只需要导入一次,一般可以在两个地方导入:

1。 src/index.js

import 'antd/dist/antd.css';

2。 src/App.css

@import '~antd/dist/antd.css';

您可以查看指导here

【讨论】:

  • 谢谢@Chrsi Su
猜你喜欢
  • 2019-05-19
  • 2020-08-08
  • 1970-01-01
  • 2022-01-06
  • 2016-01-03
  • 2018-08-18
  • 1970-01-01
  • 1970-01-01
  • 2020-02-03
相关资源
最近更新 更多