Javascript “如何突出显示精灵类型”;“图像”;使用ExtJS4.1?
我想动态突出显示类型为“image”的Ext.Draw.Sprite。所以我想添加一个彩色背景或边框之类的东西 我已经尝试过这样的addCls方法:Javascript “如何突出显示精灵类型”;“图像”;使用ExtJS4.1?,javascript,css,extjs,extjs4.1,Javascript,Css,Extjs,Extjs4.1,我想动态突出显示类型为“image”的Ext.Draw.Sprite。所以我想添加一个彩色背景或边框之类的东西 我已经尝试过这样的addCls方法: aElement.addCls('chosen-component'); 有不同的风格,比如 .chosen-component { background: url(../images/stripes.svg) !important; } 或者干脆 .chosen-component { background: red; } 或 但不幸的是,
aElement.addCls('chosen-component');
有不同的风格,比如
.chosen-component { background: url(../images/stripes.svg) !important; }
或者干脆
.chosen-component { background: red; }
或
但不幸的是,这些方法对我都不起作用
HTML确实发生了变化;看起来像
<image id="component_image-1275" xlink:href="image.svg" zIndex="0" src="image.svg" width="82" height="34" x="112.3115" y="163.9915" preserveAspectRatio="none" transform="matrix(1,0,0,1,0,0)" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);" class="chosen-component"></image>
setStyle方法也改变了HTML,但是我看不出sprite有什么不同
我认为它不起作用,因为图像标记在svg标记中,我无法对其应用样式。但这一定是有可能的
那么,如何向Ext.Draw.Sprite添加样式(如背景图像/颜色或边框)
<image id="component_image-1275" xlink:href="image.svg" zIndex="0" src="image.svg" width="82" height="34" x="112.3115" y="163.9915" preserveAspectRatio="none" transform="matrix(1,0,0,1,0,0)" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);" class="chosen-component"></image>