【问题标题】:How to override the default svg icons of antd used in the componens?如何覆盖组件中使用的 antd 的默认 svg 图标?
【发布时间】:2019-04-10 04:10:45
【问题描述】:

我想覆盖在 TimePicker、DatePicker 等组件中使用的 antd 库中使用的默认 svg 图标。等等。它曾经在我可以设置@icon-url 的变量中具有选项。但是由于新的更新使用了 svg 而不是 fontIcon,这个选项就没有了。

在版本 2 中可用 https://2x.ant.design/docs/react/customize-theme 但不在 3 https://ant.design/docs/react/customize-theme

【问题讨论】:

标签: reactjs antd


【解决方案1】:

你可以用你喜欢的css文件覆盖图标路径:

.anticon-foo svg path {
  d: path('M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 0 0 0 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z');
}

【讨论】:

  • 你能解释一下d:path()是什么意思吗?是函数调用吗?
  • d 属性定义要绘制的路径,是路径标签属性之一。
猜你喜欢
  • 2018-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-20
  • 2019-07-29
  • 2020-05-04
  • 1970-01-01
  • 2019-09-28
相关资源
最近更新 更多