mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
docs: update Tree docs (#49051)
* docs: update Tree docs * docs: update * docs: update * Update components/tree/index.zh-CN.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: Wanpan <wanpan96@163.com> * docs: update --------- Signed-off-by: Wanpan <wanpan96@163.com> Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
parent
072afcd79f
commit
86abdb9918
@ -57,16 +57,16 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
| fieldNames | Customize node title, key, children field name | object | { title: `title`, key: `key`, children: `children` } | 4.17.0 |
|
||||
| filterTreeNode | Defines a function to filter (highlight) treeNodes. When the function returns `true`, the corresponding treeNode will be highlighted | function(node) | - | |
|
||||
| height | Config virtual scroll height. Will not support horizontal scroll when enable this | number | - | |
|
||||
| icon | Customize treeNode icon | ReactNode \| (props) => ReactNode | - | |
|
||||
| icon | Insert a custom icon before the title. Need to set `showIcon` to true | ReactNode \| (props) => ReactNode | - | |
|
||||
| loadData | Load data asynchronously | function(node) | - | |
|
||||
| loadedKeys | (Controlled) Set loaded tree nodes. Need work with `loadData` | string\[] | \[] | |
|
||||
| multiple | Allows selecting multiple treeNodes | boolean | false | |
|
||||
| rootStyle | Style on the root element | CSSProperties | - | 4.20.0 |
|
||||
| selectable | Whether can be selected | boolean | true | |
|
||||
| selectedKeys | (Controlled) Specifies the keys of the selected treeNodes, multiple selection needs to set `multiple` to true | string\[] | - | |
|
||||
| showIcon | Shows the icon before a TreeNode's title. There is no default style; you must set a custom style for it if set to true | boolean | false | |
|
||||
| showIcon | Controls whether to display the `icon` node, no default style | boolean | false | |
|
||||
| showLine | Shows a connecting line | boolean \| {showLeafIcon: ReactNode \| ((props: AntTreeNodeProps) => ReactNode)} | false | |
|
||||
| switcherIcon | Customize collapse/expand icon of tree node | ReactNode \| ((props: AntTreeNodeProps) => ReactNode) | - | renderProps: 4.20.0 |
|
||||
| switcherIcon | Customize expand/collapse icons for tree nodes (With default rotate angular style) | ReactNode \| ((props: AntTreeNodeProps) => ReactNode) | - | renderProps: 4.20.0 |
|
||||
| titleRender | Customize tree node title render | (nodeData) => ReactNode | - | 4.5.0 |
|
||||
| treeData | The treeNodes data Array, if set it then you need not to construct children TreeNode. (key should be unique across the whole array) | array<{ key, title, children, \[disabled, selectable] }> | - | |
|
||||
| virtual | Disable virtual scroll when set to false | boolean | true | 4.1.0 |
|
||||
@ -131,10 +131,6 @@ Before `3.4.0`: The number of treeNodes can be very large, but when `checkable=t
|
||||
|
||||
## FAQ
|
||||
|
||||
### How to hide file icon when use showLine?
|
||||
|
||||
File icon realize by using switcherIcon. You can overwrite the style to hide it: <https://codesandbox.io/s/883vo47xp8>
|
||||
|
||||
### Why defaultExpandAll not working on ajax data?
|
||||
|
||||
`default` prefix prop only works when initializing. So `defaultExpandAll` has already executed when ajax load data. You can control `expandedKeys` or render Tree when data loaded to realize expanded all.
|
||||
|
@ -59,16 +59,16 @@ demo:
|
||||
| fieldNames | 自定义节点 title、key、children 的字段 | object | { title: `title`, key: `key`, children: `children` } | 4.17.0 |
|
||||
| filterTreeNode | 按需筛选树节点(高亮),返回 true | function(node) | - | |
|
||||
| height | 设置虚拟滚动容器高度,设置后内部节点不再支持横向滚动 | number | - | |
|
||||
| icon | 自定义树节点图标。 | ReactNode \| (props) => ReactNode | - | |
|
||||
| icon | 在标题之前插入自定义图标。需要设置 `showIcon` 为 true | ReactNode \| (props) => ReactNode | - | |
|
||||
| loadData | 异步加载数据 | function(node) | - | |
|
||||
| loadedKeys | (受控)已经加载的节点,需要配合 `loadData` 使用 | string\[] | \[] | |
|
||||
| multiple | 支持点选多个节点(节点本身) | boolean | false | |
|
||||
| rootStyle | 添加在 Tree 最外层的 style | CSSProperties | - | 4.20.0 |
|
||||
| selectable | 是否可选中 | boolean | true | |
|
||||
| selectedKeys | (受控)设置选中的树节点,多选需设置 `multiple` 为 true | string\[] | - | |
|
||||
| showIcon | 是否展示 TreeNode title 前的图标,没有默认样式,如设置为 true,需要自行定义图标相关样式 | boolean | false | |
|
||||
| showIcon | 控制是否展示 `icon` 节点,没有默认样式 | boolean | false | |
|
||||
| showLine | 是否展示连接线 | boolean \| { showLeafIcon: ReactNode \| ((props: AntTreeNodeProps) => ReactNode) } | false | |
|
||||
| switcherIcon | 自定义树节点的展开/折叠图标 | ReactNode \| ((props: AntTreeNodeProps) => ReactNode) | - | renderProps: 4.20.0 |
|
||||
| switcherIcon | 自定义树节点的展开/折叠图标(带有默认 rotate 角度样式) | ReactNode \| ((props: AntTreeNodeProps) => ReactNode) | - | renderProps: 4.20.0 |
|
||||
| titleRender | 自定义渲染节点 | (nodeData) => ReactNode | - | 4.5.0 |
|
||||
| treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(key 在整个树范围内唯一) | array<{key, title, children, \[disabled, selectable]}> | - | |
|
||||
| virtual | 设置 false 时关闭虚拟滚动 | boolean | true | 4.1.0 |
|
||||
@ -133,10 +133,6 @@ demo:
|
||||
|
||||
## FAQ
|
||||
|
||||
### 在 showLine 时,如何隐藏子节点图标?
|
||||
|
||||
文件图标通过 switcherIcon 来实现,如果不需要你可以覆盖对应的样式:<https://codesandbox.io/s/883vo47xp8>
|
||||
|
||||
### defaultExpandAll 在异步加载数据时为何不生效?
|
||||
|
||||
`default` 前缀属性只有在初始化时生效,因而异步加载数据时 `defaultExpandAll` 已经执行完成。你可以通过受控 `expandedKeys` 或者在数据加载完成后渲染 Tree 来实现全部展开。
|
||||
|
Loading…
Reference in New Issue
Block a user