2015-08-03 16:07:21 +08:00
|
|
|
# 基本
|
|
|
|
|
|
|
|
- order: 0
|
|
|
|
|
|
|
|
最简单的用法。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Tree = antd.Tree;
|
|
|
|
var TreeNode = Tree.TreeNode;
|
2015-08-10 20:23:18 +08:00
|
|
|
function handleSelect(selected, c, selectedKeys) {
|
|
|
|
console.log('selected: ', selected, c, selectedKeys );
|
2015-08-06 09:17:40 +08:00
|
|
|
}
|
|
|
|
function handleChecked(checked, c) {
|
|
|
|
console.log('checked: ', checked, c );
|
|
|
|
}
|
2015-08-03 16:07:21 +08:00
|
|
|
React.render(
|
2015-08-06 09:17:40 +08:00
|
|
|
<Tree className="myCls" onSelect={handleSelect} onChecked={handleChecked}>
|
2015-08-10 20:23:18 +08:00
|
|
|
<TreeNode title="parent 1" expanded={true}>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode title="parent 1-1">
|
|
|
|
<TreeNode title="parent 2-1">
|
2015-08-03 16:07:21 +08:00
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
</TreeNode>
|
2015-08-10 20:23:18 +08:00
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
</Tree>
|
2015-08-03 16:07:21 +08:00
|
|
|
, document.getElementById('components-tree-demo-basic'));
|
|
|
|
````
|