Merge pull request #17345 from hengkx/fix-17267

docs: Tree treeData
This commit is contained in:
偏右 2019-06-28 13:59:33 +08:00 committed by GitHub
commit c3a3db385c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -86,6 +86,16 @@ export interface AntTreeNodeDropEvent {
event: React.MouseEvent<HTMLElement>;
}
export interface TreeNodeNormal {
title?: React.ReactNode;
key: string;
isLeaf?: boolean;
disabled?: boolean;
disableCheckbox?: boolean;
selectable?: boolean;
children?: TreeNodeNormal[];
}
export interface TreeProps {
showLine?: boolean;
className?: string;
@ -153,6 +163,7 @@ export interface TreeProps {
filterTreeNode?: (node: AntTreeNode) => boolean;
children?: React.ReactNode;
blockNode?: boolean;
treeData?: Array<TreeNodeNormal>;
}
export default class Tree extends React.Component<TreeProps, any> {

View File

@ -46,6 +46,7 @@ Almost anything can be represented in a tree structure. Examples include directo
| onLoad | Callback function for when a treeNode is loaded | function(loadedKeys, {event, node}) | - |
| onRightClick | Callback function for when the user right clicks a treeNode | function({event, node}) | - |
| onSelect | Callback function for when the user clicks a treeNode | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | - |
| treeData | 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] }> | - |
### TreeNode props

View File

@ -47,6 +47,7 @@ subtitle: 树形控件
| onLoad | 节点加载完毕时触发 | function(loadedKeys, {event, node}) | - |
| onRightClick | 响应右键点击 | function({event, node}) | - |
| onSelect | 点击树节点触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | - |
| treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点key 在整个树范围内唯一) | array\<{key, title, children, \[disabled, selectable]}> | - |
### TreeNode props