reactjs - Change ReactTable heading color using css-modules
问题描述
I am not able to change the color of the header for a React table using css-modules.
My code is :
.CustomerTable.ReactTable .rt-thead.-header {
color: mediumblue;
}
How can I do this using css-modules. As far as I know I can use the css module with the elements name, only I cannot override CSS of other modules using it.
解决方案
您可以在标题部分创建自定义组件。
const columns = [
{
Header:()=><span className="my_custom_class">Name</span>,
accessor: 'name' // String-based value accessors!
},
{
Header: 'Age',
accessor: 'age',
Cell: props => <span className='number'>{props.value}</span> // Custom cell components!
}
];
在您的 style.css 中,将此样式导入您的表格组件。
.my_custom_class{
color: mediumblue;
}
现场演示:反应表
推荐阅读
- c - 在 Rust 中将 C 指针转换为结构
- sql - 如何将 SELECT 结果转换为类型化值
- python - 如何同时运行两个独立的基于深度学习的模型?
- google-bigquery - 如何在 Google 应用脚本 sql 中转义 _ 通配符?
- c# - 如何为 DateTime 验证添加范围
- sql-server - 如何在 Linux 中从文本文件中删除 ^@
- c# - 如何从整个扫描数据中仅打印数据标签?
- sap-cloud-sdk - 如何让 SAP CloudSdk BatchRequest 不忽略批处理查询中的过滤器参数?
- java - 微服务中的测试服务链
- python-3.x - Python中的错误XML到Pandas DataFrame转换