2015-08-01 14:08:04 +08:00
|
|
|
|
# Tree
|
|
|
|
|
|
|
|
|
|
- category: Components
|
|
|
|
|
- chinese: 树形控件
|
2015-08-22 20:16:24 +08:00
|
|
|
|
- type: 展示
|
2015-08-01 14:08:04 +08:00
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2015-08-05 21:18:34 +08:00
|
|
|
|
## 何时使用
|
|
|
|
|
|
2015-08-06 14:11:02 +08:00
|
|
|
|
文件夹、组织架构、生物分类、国家地区等等,世间万物的大多数结构都是树形结构。使用`树控件`可以完整展现其中的层级关系,并具有展开收起选择等交互功能。
|
2015-08-06 09:17:40 +08:00
|
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
2015-08-15 23:45:25 +08:00
|
|
|
|
### Tree props
|
|
|
|
|
|
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 |
|
|
|
|
|
|-----------|------------------------------------------|------------|--------|
|
2015-08-19 12:18:10 +08:00
|
|
|
|
|multiple | 是否支持多选 | bool | false |
|
|
|
|
|
|checkable | 是否支持选中 | bool | false |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|defaultExpandAll | 默认展开所有树节点 | bool | false |
|
2015-12-30 17:54:07 +08:00
|
|
|
|
|defaultExpandedKeys | 默认展开指定的树节点 | String[] | [] |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|expandedKeys | (受控)展开指定的树节点 | String[] | [] |
|
|
|
|
|
|checkedKeys | (受控)选中复选框的树节点 | String[] | [] |
|
2015-08-19 12:18:10 +08:00
|
|
|
|
|defaultCheckedKeys | 默认选中复选框的树节点 | String[] | [] |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|selectedKeys | (受控)设置选中的树节点 | String[] | - |
|
2015-08-19 12:18:10 +08:00
|
|
|
|
|defaultSelectedKeys | 默认选中的树节点 | String[] | [] |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|onExpand | 展开/收起节点时触发 | function(node, expanded, expandedKeys) | - |
|
2016-01-29 11:31:10 +08:00
|
|
|
|
|onCheck | 点击复选框触发 | function(checkedKeys, e:{checked: bool, checkedNodes, node, event}) | - |
|
|
|
|
|
|onSelect | 点击树节点触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | - |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|filterTreeNode | filter some treeNodes as you need. it should return true | function(node) | - |
|
|
|
|
|
|loadData | 异步加载数据 | function(node)| - |
|
2016-01-28 15:13:17 +08:00
|
|
|
|
|onRightClick | 响应右键点击 | function({event,node}) | - |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|draggable | 设置节点可拖拽(IE>8) | bool | false |
|
2016-01-14 00:41:25 +08:00
|
|
|
|
|onDragStart | 开始拖拽时调用 | function({event,node}) | - |
|
|
|
|
|
|onDragEnter | dragenter 触发时调用 | function({event,node,expandedKeys}) | - |
|
|
|
|
|
|onDragOver | dragover 触发时调用 | function({event,node}) | - |
|
|
|
|
|
|onDragLeave | dragleave 触发时调用 | function({event,node}) | - |
|
|
|
|
|
|onDrop | drop 触发时调用 | function({event, node, dragNode, dragNodesKeys}) | - |
|
2015-08-15 23:45:25 +08:00
|
|
|
|
|
|
|
|
|
### TreeNode props
|
|
|
|
|
|
|
|
|
|
| 参数 | 说明 | 类型 | 默认值 |
|
2015-08-06 09:17:40 +08:00
|
|
|
|
|-----------|------------------------------------------|------------|--------|
|
2015-08-15 23:45:25 +08:00
|
|
|
|
|disabled | 禁掉响应 | bool | false |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|disableCheckbox | 禁掉 checkbox | bool | false |
|
2015-08-15 23:45:25 +08:00
|
|
|
|
|title | 标题 | String | '---' |
|
2016-01-07 19:05:55 +08:00
|
|
|
|
|key | 被树的 (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys 属性所用。注意:整个树范围内的所有节点的 key 值不能重复! | String | 内部计算出的节点位置 |
|
|
|
|
|
|isLeaf | 设置为叶子节点 | bool | false |
|