肉山谷英雄传说新手任务登录英文网站怎么做,老牛影视传媒有限公司,网站建设的功能定位,如何建立官网背景#xff1a; 我使用antd 的Icon组件引入SVG图片#xff0c;但给svg图片定义styles样式时#xff0c;不生效#xff0c;为什么呢#xff1f; 我们平时用antd组件库的 ArrowRightOutlined style{{color: red }}时为什么会生效呢#xff0c;但我图一这样定义就…背景 我使用antd 的Icon组件引入SVG图片但给svg图片定义styles样式时不生效为什么呢 我们平时用antd组件库的 ArrowRightOutlined style{{color: red }}时为什么会生效呢但我图一这样定义就不生效呢
原因是因为这个SVG 文件的原因是因为UI给我们生成的文件就不能接收style属性粗暴说法其实Icon会转化这些属性。 如图二所示 fill none 改为 fillcurrentColor 就可以接收color属性了并把path标签上的fill属性删掉。 import { ReactComponent as RightArrow2 } from /assets/images/home/rightArrow2.svgIcon component{() RightArrow2 style{{ color: red }} /} alt /