reactjs - 如何删除或更改 ant design table 行悬停的颜色?
问题描述
我正在处理一个我们正在尝试应用主题切换器的项目,但是 ant 设计的表格有一个默认的悬停属性,它阻止我们完成。
我有一张表,使用 Styled Components 进行样式设置,如下所示:
export const StyledTable = styled((props: TableProps<IRoute>) => (
<Table {...props} />
))`
th.ant-table-cell,
button,
td {
color: ${(props) => props.theme.colors.text};
background: ${(props) => props.theme.colors.background};
}
span,
svg {
color: ${(props) => props.theme.colors.text};
}
.tag {
background: ${(props) => props.theme.colors.background};
}
td {
border-color: ${(props) => props.theme.colors.strokes};
}
span.ant-tag.ant-tag-green {
color: ${(props) => props.theme.colors.text2};
background: ${(props) => props.theme.colors.approved};
border: 0;
}
span.ant-tag.ant-tag-red {
color: ${(props) => props.theme.colors.text2};
background: ${(props) => props.theme.colors.rejected};
border: 0;
}
span.ant-tag.ant-tag-orange {
color: ${(props) => props.theme.colors.text2};
background: ${(props) => props.theme.colors.pending};
border: 0;
}
span.ant-tag.ant-tag-purple {
border: 2px solid #d3adf7;
font-weight: 600;
}
.routesTable .ant-table .ant-table-tbody .ant-table-cell > tr:hover > td {
background: unset;
}
`;
此表的样式如下所示:
export const StyledTable = styled((props: TableProps<IRoute>) => (
<Table {...props} />
))`
th.ant-table-cell,
button,
td {
color: ${(props) => props.theme.colors.text};
background: ${(props) => props.theme.colors.background};
}
span,
svg {
color: ${(props) => props.theme.colors.text};
}
.tag {
background: ${(props) => props.theme.colors.background};
}
td {
border-color: ${(props) => props.theme.colors.strokes};
}
span.ant-tag.ant-tag-green {
color: ${(props) => props.theme.colors.text2};
background: ${(props) => props.theme.colors.approved};
border: 0;
}
span.ant-tag.ant-tag-red {
color: ${(props) => props.theme.colors.text2};
background: ${(props) => props.theme.colors.rejected};
border: 0;
}
span.ant-tag.ant-tag-orange {
color: ${(props) => props.theme.colors.text2};
background: ${(props) => props.theme.colors.pending};
border: 0;
}
span.ant-tag.ant-tag-purple {
border: 2px solid #d3adf7;
font-weight: 600;
}
.routesTable .ant-table .ant-table-tbody .ant-table-cell > tr:hover > td {
background: unset;
}
`;
但它现在正在工作。
我在研究中看到其他人有同样的问题,但没有人设法解决它。有谁知道是否可以取消或更改 ant 设计表的悬停颜色?
解决方案
推荐阅读
- database - 表示关系
- php - 自定义 WordPress 主题:未找到商店页面
- django - Django - 使用 Forms 进行嵌套循环和模板渲染
- kubernetes - 为什么 Kubernetes HPA 转换自定义指标?
- python - 将单个 numpy 数组的值添加到其他 numpy 数组中的所有列
- android - 改变recyclerview的footer itemView的view text
- ios - 检测我的控制器是否显示为弹出框
- outlook - 401 身份验证错误 MS Graph 与 Outlook 365 帐户
- python - 如何找到特定文件的路径
- java - 如何在我的项目中找到寻址/访问文件系统的每一段代码?