<p>在使用React创建一个前后图像滑动器时,我遇到了这个错误。
我不知道是否需要导入它,但不幸的是它是一个外部文件。
任何提示和建议都将不胜感激</p>
<pre class="brush:php;toolbar:false;"><div class="scroller scroller-top">
                    <svg class="scroller__thumb" xmlns="http://www.w3.org/2000/svg" width="100"   height="100" viewBox="0 0 100 100"><polygon points="0 50 37 68 37 32 0 50" style="fill:rgb(24,24,62)"/><polygon points="100 50 64 32 64 68 100 50" style="fill:rgb(24,24,62)"/></svg>
</div></pre>
<p>我期望看到SVG图标,但实际上抛出了一个错误,如上述描述所示</p>            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
         
        
        
您可以直接在多边形上添加
fill属性,如下所示:<div className="scroller scroller-top"> <svg className="scroller__thumb" xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100" > <polygon points="0 50 37 68 37 32 0 50" fill="rgb(24,24,62)" /> <polygon points="100 50 64 32 64 68 100 50" fill="rgb(24,24,62)" /> </svg> </div>奖励:如果您使用React,则
class属性应为className。