Reactjs 如何在React中传递svg标记中的样式?
我想通过考试Reactjs 如何在React中传递svg标记中的样式?,reactjs,svg,Reactjs,Svg,我想通过考试 <svg class="svg-abs svg-f-btm" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1920 140" style="margin-bottom: -9px; backgroundImage:new 0 0 1920 140;" xmlSpace="preserve
<svg class="svg-abs svg-f-btm" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1920 140" style="margin-bottom: -9px; backgroundImage:new 0 0 1920 140;" xmlSpace="preserve">
<path class="svg-gray" d="M960,92.9C811.4,93.3,662.8,89.4,515.3,79c-138.6-9.8-277.1-26.2-409-53.3C97.8,24,0,6.5,0,0c0,0,0,140,0,140
l960-1.2l960,1.2c0,0,0-140,0-140c0,2.7-42.1,11.3-45.8,12.2c-45.1,11-91.5,20.1-138.4,28.1c-176.2,30.1-359.9,43.8-542.9,48.9
C1115.4,91.4,1037.7,92.7,960,92.9z"></path>
</svg>
如何更正它?在react中,您可以这样传递它:
style={{{marginBottom:-9px;backgroundImage:new 0 0 1920 140}
,对于属性,请删除“-”,并使用camelCase您需要这样做
style={{marginBottom: “-9px”, backgroundImage: “new 0 0 1920 140”}}
当我将双引号改为单引号时,它起作用了,谢谢
style={{marginBottom: “-9px”, backgroundImage: “new 0 0 1920 140”}}