Out of the box the control highlights a selected item with a light blue border. I can't see where this is coming from, and I'd like to make the styling a bit more emphatic.
I compared a selected and unselected node in the dom, and they look basically the same:
在框外,该控件用浅蓝色边框突出显示选定的项。我看不出这是从哪里来的,我想让造型更强调一点。我比较了DOM中选中和未选中的节点,它们看起来基本相同:
Unselected node:
未选择的节点:
<div role="treeitem"
class="p-treenode-content p-treenode-selectable"
draggable="false"
ng-reflect-ng-class="[object Object]"
tabindex="0"
aria-posinset="4"
aria-selected="false"
aria-label="Label1">...
</div>
Selected node:
所选节点:
<div role="treeitem"
class="p-treenode-content p-treenode-selectable"
draggable="false"
ng-reflect-ng-class="[object Object]"
tabindex="0"
aria-posinset="5"
aria-selected="false"
aria-label="Label2">...
</div>
I'd expect the selected node to have a class added or some other attribute I can key off for CSS, but these look identical. I can definitely put something in to set the class, but that seems ugly and something p-tree should support out of the box. But I can't see anything in the generated HTML or the API description to tell me how to do it. Something is going on because it does have that blue border, but I can't see where it is coming from. Maybe ng-reflect-ng-class
but not sure how I'd use that.
我希望选定的节点添加了一个类或其他一些我可以为css键入的属性,但它们看起来是一样的。我当然可以放入一些东西来设置这个类,但这看起来很难看,而且p-tree应该开箱即支持。但我在生成的HTML或API描述中看不到任何东西来告诉我如何做到这一点。发生了一些事情,因为它确实有那个蓝色边框,但我看不出它是从哪里来的。也许是NG-Reflect-NG-Class,但不确定我会如何使用它。
Ultimately I want a CSS selector that allows me to set the selected item to, for example, have a gray background.
最终,我想要一个CSS选择器,它允许我设置所选项目,例如,具有灰色背景。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!