# react-do-tree-select
一个选择树[React]组件.
[](https://www.npmjs.com/package/react-do-tree-select)

[](https://www.npmjs.com/package/react-do-tree-select?minimal=true)
[English document](./README.md)
## 特性
- 支持大量的数据( 测试一百万条数据稳定 )
- 支持半选功能( 即使子节点全选,也不会影响父级的勾选 )
## 演示
- [online](https://hjyue1.github.io/react-do-tree-select/demo/modifyParams/)
## 安装
```bash
npm install react-do-tree-select --save
# or
yarn install react-do-tree-select
```
react-do-tree-select 基于 React
## 例子
下面是一个简单的例子
```js
import React from 'react';
import TreeSelect from 'react-do-tree-select';
import Data from './Data';
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
treeData: [],
selectVal: '',
showlevel: 0,
}
this.onSelect = this.onSelect.bind(this);
this.onExpand = this.onExpand.bind(this);
this.onChecked = this.onChecked.bind(this);
this.customTitleRender = this.customTitleRender.bind(this);
}
componentDidMount() {
const treeData = Data;
this.setState({treeData});
}
customTitleRender(item) {
return item.title
}
onSelect(val, e) {
console.log(val);
}
onExpand(val, e) {
console.log(val);
}
onChecked(val, e) {
console.log(val);
}
render() {
return (
const { treeData, showlevel } = this.state;
const checkbox = {
enable: true,
parentChain: true, // child Affects parent nodes;
childrenChain: true, // parent Affects child nodes;
halfChain: true, // The selection of child nodes affects the semi-selection of parent nodes.
initCheckedList: [] // Initialize check multiple lists
}
return (