vite-plugin-svgr
vite-plugin-svgr copied to clipboard
如何改变颜色
使用这个 我如何改变svg的颜色
参考 https://github.com/pd4d10/vite-plugin-svgr/issues/72#issue-1609038919 的方式引入 SVG 组件后,可通过 <SvgIcon fill="currentColor" />
,以及为 <svg>
后代元素 <path>
设置 fill: inherit;
来改变颜色
<span style={{ color: "blue" }}>
<SvgIcon
className="change-color"
fill="currentColor"
/>
</span>
.change-color path{
fill: inherit;
}