[英]How can I put end Icon in TreeView Material UI in ReactJS?
I'm using React TreeItem
material UI.我正在使用 React TreeItem
材质 UI。 I am using the custom StyledTreeItem
function from here .我从这里使用自定义StyledTreeItem
function 。 The thign I want is icon at the end of label.我想要的是 label 末尾的图标。 I want to use endIcon
but it is not working.我想使用endIcon
但它不起作用。
Here is the code which I have done so far: <StyledTreeItem endIcon={ArrowDropDownIcon}></StyledTreeItem>;
这是我到目前为止所做的代码: <StyledTreeItem endIcon={ArrowDropDownIcon}></StyledTreeItem>;
What I want to do is to use SVG icon in endIcon
like this: <StyledTreeItem endIcon={<ArrowDropDownIcon />}></StyledTreeItem>;
我想做的是在endIcon
中使用 SVG 图标,如下所示: <StyledTreeItem endIcon={<ArrowDropDownIcon />}></StyledTreeItem>;
The function which I'm using has been taken from here .我使用的 function 取自这里。
But somehow it is not working.但不知何故,它不起作用。
Is this achievable?这是可以实现的吗? How can I do this?我怎样才能做到这一点?
endIcon property doesn't place the icon at the end of label but it places the icon beside the last child of the node. endIcon 属性不会将图标放在 label 的末尾,但会将图标放在节点的最后一个子节点旁边。 TreeItem API树项 API
However, if you need your icon to be placed at the end of label, it can be achieved with css.但是,如果您需要将您的图标放在 label 的末尾,则可以通过 css 来实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.