为 antd 表格滚动条应用内联 css
如何为滚动条应用内联CSS?我需要更改 antd Table 滚动的默认宽度和颜色。
<Table style={{ width: '100%' }} scroll={{ y: 80 }}
pagination={false}
columns={columns}
dataSource={data} />
How to apply inline css for the scroll bar? I need to change default width and color of scroll of the antd Table.
<Table style={{ width: '100%' }} scroll={{ y: 80 }}
pagination={false}
columns={columns}
dataSource={data} />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要将样式应用于 antd 表滚动条或任何 CSS,我们可以通过数据所在位置的选择器来实现
可以指定类并使用 webkit-scrollbar 进行设计
To Apply styles to antd Table scroll bar or any CSS we can achieve it by selector of where the data is present
You can specify the class and use webkit-scrollbar for desiging
我从上面的答案中得到了如何做到这一点的想法,但我的解决方案是不同的。我使用 devTools 找到了那个伪属性,但我的在
.ant-table
下,而不是.ant-table-content
也许我们使用的是不同版本的 antd?
这适用于 v3.15.1:
I got the idea of how to do it from the answer above but my solution was different. I used devTools to find that pseudo property but mine was under
.ant-table
not.ant-table-content
Perhaps we are on different versions of antd?
This works for v3.15.1:
这在 v5.7.0 上对我有用:
this is worked for me on v5.7.0 :