cjd-parkball
Version:
> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用
53 lines (42 loc) • 1.14 kB
Markdown
---
category: 2
title: 目录
title_en: directory
---
zh-CN
内置的目录树,`multiple` 模式支持 `ctrl(Windows)` / `command(Mac)` 复选。
en-US
Built-in directory tree. `multiple` support `ctrl(Windows)` / `command(Mac)` selection.
````jsx
import { Tree } from 'parkball';
const DirectoryTree = Tree.DirectoryTree;
const TreeNode = Tree.TreeNode;
class Demo extends React.Component {
onSelect = () => {
console.log('Trigger Select');
};
onExpand = () => {
console.log('Trigger Expand');
};
render() {
return (
<DirectoryTree
multiple
defaultExpandAll
onSelect={this.onSelect}
onExpand={this.onExpand}
>
<TreeNode title="parent 0" key="0-0">
<TreeNode title="leaf 0-0" key="0-0-0" isLeaf />
<TreeNode title="leaf 0-1" key="0-0-1" isLeaf />
</TreeNode>
<TreeNode title="parent 1" key="0-1">
<TreeNode title="leaf 1-0" key="0-1-0" isLeaf />
<TreeNode title="leaf 1-1" key="0-1-1" isLeaf />
</TreeNode>
</DirectoryTree>
);
}
}
ReactDOM.render(<Demo />, mountNode);
````