How to customize the background color of Antd React directory tree node?
P粉825079798
P粉825079798 2023-09-03 12:09:15
0
1
718
<p>How to change the default background color of an antd directory tree node when the mouse is hovering over the tree node using less style? </p> <pre class="brush:php;toolbar:false;"><Tree.DirectoryTree> {data.map((item) => { return ( <Tree.TreeNode // @ts-ignore item={item} icon={<></>} key={item.user_folder_id} title={item.title} > {item?.data.map((node) => { return ( <Tree.TreeNode node={node} key={node.node_id} title={node.title} ></Tree.TreeNode> ); })} </Tree.TreeNode> ); })} </Tree.DirectoryTree></pre></p>
P粉825079798
P粉825079798

reply all(1)
P粉797855790
<Tree.DirectoryTree className="custom-tree">
        {data.map((item) => {
          return (
            <Tree.TreeNode
              // @ts-ignore
              item={item}
              icon={<></>}
              key={item.user_folder_id}
              title={item.title}
            >
              {item?.data.map((node) => {
                return (
                  <Tree.TreeNode
                    node={node}
                    key={node.node_id}
                    title={ node.title }
                  ></Tree.TreeNode>
                );
              })}

            </Tree.TreeNode>
          );
        })}
      </Tree.DirectoryTree>

styles.less

.custom-tree .ant-tree-treenode:hover::before {
  background: blue !important;
}


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template