# taro-ztree

> ztree,taro版

Latest version **1.0.9** (published 2020-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install taro-ztree
pnpm add taro-ztree
yarn add taro-ztree
bun add taro-ztree
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2020-03-19 |
| First published | 2020-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 17 |
| Unpacked size | 252.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | wangystrive |

## Links

- npm: https://www.npmjs.com/package/taro-ztree
- npm.io page: https://npm.io/package/taro-ztree

## Dependencies (17)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [nervjs](https://npm.io/package/nervjs.md) ^1.5.5
- [rc-util](https://npm.io/package/rc-util.md) ^4.20.0
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [@tarojs/taro](https://npm.io/package/@tarojs/taro.md) 2.0.2
- [nerv-devtools](https://npm.io/package/nerv-devtools.md) ^1.5.5
- [@tarojs/router](https://npm.io/package/@tarojs/router.md) 2.0.2
- [@tarojs/taro-h5](https://npm.io/package/@tarojs/taro-h5.md) 2.0.2
- [@tarojs/taro-qq](https://npm.io/package/@tarojs/taro-qq.md) 2.0.2
- [@tarojs/taro-rn](https://npm.io/package/@tarojs/taro-rn.md) 2.0.2
- [@tarojs/taro-tt](https://npm.io/package/@tarojs/taro-tt.md) 2.0.2
- [@tarojs/taro-swan](https://npm.io/package/@tarojs/taro-swan.md) 2.0.2
- [@tarojs/components](https://npm.io/package/@tarojs/components.md) 2.0.2
- [@tarojs/taro-weapp](https://npm.io/package/@tarojs/taro-weapp.md) 2.0.2
- [@tarojs/taro-alipay](https://npm.io/package/@tarojs/taro-alipay.md) 2.0.2
- [@tarojs/components-qa](https://npm.io/package/@tarojs/components-qa.md) 2.0.2
- [@tarojs/taro-quickapp](https://npm.io/package/@tarojs/taro-quickapp.md) 2.0.2

## Recent versions

- 1.0.9 (latest) — 2020-03-19
- 1.0.8 — 2020-03-17
- 1.0.7 — 2020-03-17
- 1.0.6 — 2020-03-17
- 1.0.5 — 2020-03-17
- 1.0.4 — 2020-03-17
- 1.0.3 — 2020-03-17
- 1.0.2 — 2020-03-17
- 1.0.1 — 2020-03-17
- 1.0.0 — 2020-03-17

## README

# taro-zTree
taro版树形组件
### 安装
```bash
npm i -S taro-ztree
```
### 使用
```javascript
import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import Tree from 'taro-ztree'

const data = [
  { key: 1, parent: 0, title: "普通的父节点",  open:true},
  { key: 11, parent: 1, title: "叶子节点 - 1", },
  { key: 12, parent: 1, title: "叶子节点 - 2",},
  { key: 13, parent: 1, title: "叶子节点 - 3", },
  { key: 34, parent: 11, title:  "叶子节点 - 1 - 1", },
  { key: 2, parent: 0, title: "NB的父节点", open:true},
  { key: 21, parent: 2, title: "叶子节点2 - 1", },
  { key: 22, parent: 2, title: "叶子节点2 - 2",},
  { key: 23, parent: 2, title: "叶子节点2 - 3",},
  { key: 3, parent: 0, title: "郁闷的父节点",  open:true},
  { key: 31, parent: 3, title: "叶子节点3 - 1",},
  { key: 32, parent: 3, title: "叶子节点3 - 2", },
  { key: 33, parent: 3, title: "叶子节点3 - 3",}
]

export class TreeDemo extends Component {
  checkNode (keys) {
    console.log('选中的节点为: ', keys)
  }
  render () {
    return (
      <View className='tree-demo'>
        <Tree treeData={data} checkedKeys={[32]} onNodeCheck={this.checkNode.bind(this)} />
      </View>
    )
  }
}
```
### 效果图
![效果图](./demo.gif)
### 组件参数

| 参数名 | 说明 | 默认值 |
|  ----  | ---- | ----   |
|  treeData | 原始数据(Array) | [] |
|  checkedKeys | 默认选中的值(Array) | [] |
| open | 是否展开节点(Bool) | false |
|  showCheckBox | 是否显示多选框(Bool) | true |
|  showIcon | 是否显示图标(Bool) | true |
|  onNodeCheck | 多选框选中时的回调，返回选中的值(Function) | null |

---
_Source: https://npm.io/package/taro-ztree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
