2015-08-03 16:07:21 +08:00
|
|
|
# 基本
|
|
|
|
|
|
|
|
- order: 0
|
|
|
|
|
|
|
|
最简单的用法。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Tree = antd.Tree;
|
|
|
|
var TreeNode = Tree.TreeNode;
|
2015-08-06 09:17:40 +08:00
|
|
|
function handleSelect(selected, c) {
|
|
|
|
console.log('selected: ', selected, c );
|
|
|
|
}
|
|
|
|
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}>
|
|
|
|
<TreeNode title="parent 1" expanded={true}>
|
2015-08-03 16:07:21 +08:00
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode title="parent 1-1">
|
|
|
|
<TreeNode title="parent 2-1">
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
</TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
<TreeNode>
|
|
|
|
<TreeNode>leaf </TreeNode>
|
|
|
|
</TreeNode>
|
2015-08-06 09:17:40 +08:00
|
|
|
</Tree>
|
2015-08-03 16:07:21 +08:00
|
|
|
, document.getElementById('components-tree-demo-basic'));
|
|
|
|
````
|
|
|
|
|