简体   繁体   English

如何在我的 TreeItem Material UI 4 中添加图标

[英]How add a icon in my TreeItem Material UI 4

I have a menu made with MATERIAL UI 4, it is composed of a first TreeItem with my main menu and a second TreeItem with my submenu.我有一个使用 MATERIAL UI 4 制作的菜单,它由第一个 TreeItem 和我的主菜单和第二个 TreeItem 和我的子菜单组成。

I would like to add a specific icon to each label of the main menu.我想为主菜单的每个 label 添加一个特定的图标。

How can I do?我能怎么做?

Is it possible that when I click on two drop-down menus, the first is reset by default ( no dropdown ).是否有可能当我单击两个下拉菜单时,默认情况下会重置第一个(无下拉菜单)。

    {stoMenu && (
      <TreeView
        style={test.menu}
      >
        {Menu.root.children.map(test=> {
          return (
            <TreeItem
              key={test.nodeId}
              nodeId={test.nodeId}
              label={test.text}
            >
              {test.children.map(child => {
                return (
                  <TreeItem
                    key={child.nodeId}
                    nodeId={child.nodeId}
                    label={child.text}
                  >
                    <Redirect to={child.id} />
                  </TreeItem>
                );
              })}
            </TreeItem>
          );
        })}
      </TreeView>
    )}

They have great example how to do that https://codesandbox.io/s/material-demo-ui4dx他们有很好的例子如何做到这一点https://codesandbox.io/s/material-demo-ui4dx

Also be careful with TreeView component as it is still inLab and can be with some issues and not finished implementation.还要小心TreeView组件,因为它仍处于实验室中,可能存在一些问题并且尚未完成实施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM