mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-26 01:42:30 +08:00
756 B
756 B
order | title | ||||
---|---|---|---|---|---|
6 |
|
zh-CN
可以针对不同的节点定制图标。
en-US
You can customize icons for different nodes.
import { Tree, Icon } from 'antd';
const { TreeNode } = Tree;
ReactDOM.render(
<Tree
showIcon
defaultExpandAll
defaultSelectedKeys={['0-0-0']}
switcherIcon={<Icon type="down" />}
>
<TreeNode icon={<Icon type="smile-o" />} title="parent 1" key="0-0">
<TreeNode icon={<Icon type="meh-o" />} title="leaf" key="0-0-0" />
<TreeNode
icon={({ selected }) => (
<Icon type={selected ? 'frown' : 'frown-o'} />
)}
title="leaf"
key="0-0-1"
/>
</TreeNode>
</Tree>,
mountNode
);