【发布时间】:2020-01-23 23:23:15
【问题描述】:
我在我的反应项目中使用Ant Design。我想使用没有默认类名的 Ant Design 组件。
注意以下代码:
import { Typography } from "antd";
const { Title } = Typography;
~~
<Title level={4}> ...
原因如下:
<h4 class="ant-typography" ...
还有它的 CSS:
// in the less file:
h4.ant-typography {
// some css
}
所以当我将我的类名添加到组件时,Ant Design 组件的类名的优先级高于我的!
我的班级名称是.root-23-07。此优先级编号为10,但由于在less 文件中使用标签名称,And Design CSS 选择的优先级编号为11。所以 Ant Design 样式会覆盖我的样式。
我想使用没有默认类名的 And Design 组件。 有可能吗?
【问题讨论】: