【问题标题】:How to change color of Icon which make from createFromIconfontCN with Ant Design?如何使用 Ant Design 更改从 createFromIconfontCN 制作的 Icon 的颜色?
【发布时间】:2020-11-12 09:01:58
【问题描述】:

我想通过ant-design图标工具的函数**createFromIconfontCN**改变图标的​​颜色,但是我找不到自定义的方法。
有什么办法可以改变它的颜色吗?

这是我的代码:

import { createFromIconfontCN } from '@ant-design/icons';

const IconFont = createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/font_1920998_qwtyc6g5q7f.js',
});

ReactDOM.render(
  <div>
    <IconFont type="iconright"></IconFont>
  </div>,
  mountNode,
);

你可以在这里查看:
https://ant.design/components/icon/
部分:**使用iconfont.cn**

谢谢!

【问题讨论】:

    标签: css reactjs antd ant-design-pro icon-fonts


    【解决方案1】:

    如果您在 style 属性中包含您想要的颜色,它会更改颜色。

    <IconFont type="iconright" style={{ color: "green" }} />
    

    检查this沙盒

    【讨论】:

      猜你喜欢
      • 2019-04-26
      • 1970-01-01
      • 2020-11-16
      • 2020-08-28
      • 2021-03-05
      • 2021-06-30
      • 1970-01-01
      • 2021-02-25
      • 2021-04-17
      相关资源
      最近更新 更多