CSS伪元素中如何使用antd图标

How to use antd icons in CSS pseudo-elements

我目前得到这样的图标:

import { Icon } from "antd";
...

// inside react component:
<div className="someclass">
  <Icon type="thunderbolt" /> 
</div>

我真正想做的是这个,CSS:

div.someclass::before {
  content: "\E6EA"; // pretend this is the correct thunderbolt icon code
}

现在我认为我正在阅读 antd 不使用图标字体,而是直接使用 SVG。那是对的吗?这是否意味着 CSS 无法使用 antd 插入图标?

不,您现在不能使用 CSS 伪元素,它们取代了 SVG(自版本 3.9.0 起)。你可以 read it here and the pr discussion why here.