You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/tree/index.zh-CN.md

73 lines
4.4 KiB

7 years ago
## API
### Tree props
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| treeData | 节点的配置描述,具体项见下表, 1.1.4之前的版本使用`treeNodes` | array | -- |
7 years ago
| autoExpandParent | 是否自动展开父节点 | boolean | true |
| checkable | 节点前添加 Checkbox 复选框 | boolean | false |
| checkedKeys(v-model) | 受控选中复选框的树节点注意父子节点有关联如果传入父节点key则子节点自动选中相应当子节点key都传入父节点也自动选中。当设置`checkable`和`checkStrictly`,它是一个有`checked`和`halfChecked`属性的对象,并且父子节点的选中与否不再关联 | string\[] \| number\[] \| {checked: string\[] \| number\[], halfChecked: string\[] \| number\[]} | \[] |
7 years ago
| checkStrictly | checkable状态下节点选择完全受控父子节点选中状态不再关联 | boolean | false |
| defaultCheckedKeys | 默认选中复选框的树节点 | string\[] \| number\[] | \[] |
7 years ago
| defaultExpandAll | 默认展开所有树节点 | boolean | false |
| defaultExpandedKeys | 默认展开指定的树节点 | string\[] \| number\[] | \[] |
7 years ago
| defaultExpandParent | 默认展开父节点 | bool | true |
| defaultSelectedKeys | 默认选中的树节点 | string\[] \| number\[] | \[] |
7 years ago
| disabled | 将树禁用 | bool | false |
7 years ago
| draggable | 设置节点可拖拽 | boolean | false |
| expandedKeys(.sync) | (受控)展开指定的树节点 | string\[] \| number\[] | \[] |
7 years ago
| filterTreeNode | 按需筛选树节点高亮返回true | function(node) | - |
| loadData | 异步加载数据 | function(node) | - |
| loadedKeys | (受控)已经加载的节点,需要配合 `loadData` 使用 | string\[] \| number\[] | \[] |
7 years ago
| multiple | 支持点选多个节点(节点本身) | boolean | false |
| selectedKeys(.sync) | (受控)设置选中的树节点 | string\[] \| number\[] | - |
7 years ago
| showIcon | 是否展示 TreeNode title 前的图标,没有默认样式,如设置为 true需要自行定义图标相关样式 | boolean | false |
| showLine | 是否展示连接线 | boolean | false |
7 years ago
### 事件
| 事件名称 | 说明 | 回调参数 |
| --- | --- | --- |
| check | 点击复选框触发 | function(checkedKeys, e:{checked: bool, checkedNodes, node, event}) |
| dragend | dragend 触发时调用 | function({event, node}) |
| dragenter | dragenter 触发时调用 | function({event, node, expandedKeys}) |
| dragleave | dragleave 触发时调用 | function({event, node}) |
| dragover | dragover 触发时调用 | function({event, node}) |
| dragstart | 开始拖拽时调用 | function({event, node}) |
| drop | drop 触发时调用 | function({event, node, dragNode, dragNodesKeys}) |
| expand | 展开/收起节点时触发 | function(expandedKeys, {expanded: bool, node}) |
| load | 节点加载完毕时触发 | function(loadedKeys, {event, node}) |
| rightClick | 响应右键点击 | function({event, node}) |
| select | 点击树节点触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) |
7 years ago
### TreeNode props
7 years ago
结点描述数据对象,是 treeNodes 中的一项TreeNode 使用相同的 API。
7 years ago
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
7 years ago
| class | 节点的 class | string | - |
| style | 节点的 style | string\|object | - |
7 years ago
| disableCheckbox | 禁掉 checkbox | boolean | false |
| disabled | 禁掉响应 | boolean | false |
7 years ago
| icon | 自定义图标。可接收组件props 为当前节点 props | slot\|slot-scope | - |
7 years ago
| isLeaf | 设置为叶子节点(设置了`loadData`时有效) | boolean | false |
| key | 被树的 (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys 属性所用。注意:整个树范围内的所有节点的 key 值不能重复! | string \| number | 内部计算出的节点位置 |
7 years ago
| selectable | 设置节点是否可被选中 | boolean | true |
7 years ago
| title | 标题 | string\|slot\|slot-scope | '---' |
| slots | 使用treeNodes时可以通过该属性配置支持slot的属性`slots: { title: 'XXX'}` | object | - |
| scopedSlots | 使用columns时可以通过该属性配置支持slot-scope的属性`scopedSlots: { title: 'XXX'}` | object | - |
| on | 事件对象仅在treeNodes使用方式中生效如`{click: () => {}}` | object | '---' |
7 years ago
### DirectoryTree props
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| expandAction | 目录展开逻辑,可选 `false` `'click'` `'doubleclick'` | string | click |
7 years ago