mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
e7aa014c31
* docs: init * chore: all types * docs: faq * chore: fix lint
43 lines
789 B
TypeScript
43 lines
789 B
TypeScript
import React from 'react';
|
|
import {
|
|
DownOutlined,
|
|
FrownFilled,
|
|
FrownOutlined,
|
|
MehOutlined,
|
|
SmileOutlined,
|
|
} from '@ant-design/icons';
|
|
import { Tree } from 'antd';
|
|
import type { TreeDataNode } from 'antd';
|
|
|
|
const treeData: TreeDataNode[] = [
|
|
{
|
|
title: 'parent 1',
|
|
key: '0-0',
|
|
icon: <SmileOutlined />,
|
|
children: [
|
|
{
|
|
title: 'leaf',
|
|
key: '0-0-0',
|
|
icon: <MehOutlined />,
|
|
},
|
|
{
|
|
title: 'leaf',
|
|
key: '0-0-1',
|
|
icon: ({ selected }) => (selected ? <FrownFilled /> : <FrownOutlined />),
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
const App: React.FC = () => (
|
|
<Tree
|
|
showIcon
|
|
defaultExpandAll
|
|
defaultSelectedKeys={['0-0-0']}
|
|
switcherIcon={<DownOutlined />}
|
|
treeData={treeData}
|
|
/>
|
|
);
|
|
|
|
export default App;
|