You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

804 B

order title
6 [{zh-CN 自定义图标} {en-US Customize Icon}]

zh-CN

可以针对不同的节点定制图标。

en-US

You can customize icons for different nodes.

import { Tree } from 'antd';
import { Down, Frown, Smile, Meh, FrownFilled } from '@ant-design/icons';

const treeData = [
  {
    title: 'parent 1',
    key: '0-0',
    icon: <Smile />,
    children: [
      {
        title: 'leaf',
        key: '0-0-0',
        icon: <Meh />,
      },
      {
        title: 'leaf',
        key: '0-0-1',
        icon: ({ selected }) => (selected ? <FrownFilled /> : <Frown />),
      },
    ],
  },
];

ReactDOM.render(
  <Tree
    showIcon
    defaultExpandAll
    defaultSelectedKeys={['0-0-0']}
    switcherIcon={<Down />}
    treeData={treeData}
  />,
  mountNode,
);