[英]Embedding images in SVG in React
I am using SVG inside React, but the amount of SVG tags that ReactJS allows is limited and I don't see a way to embed an <image/>
SVG tag inside my JSX. 我在React中使用SVG,但是ReactJS允许的SVG标签数量有限 ,我没有看到在我的JSX中嵌入<image/>
SVG标签的方法。
I've also tried using a fill
style on a rect
set to a url of an image, but it doesn't work either. 我也尝试在rect
集上使用fill
样式到图像的URL,但它也不起作用。 Is there a workaround for this? 这有解决方法吗?
SVG Image is now supported in 0.14. SVG Image现在支持0.14。
For prior versions, you can use dangerouslySetInnerHTML
. 对于以前的版本,您可以使用dangerouslySetInnerHTML
。 For more about that, take a look at this issue: 有关更多相关信息,请查看此问题:
https://github.com/facebook/react/issues/2069 https://github.com/facebook/react/issues/2069
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.