mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
docs: [tree] unified format (#18608)
* docs: [tree] unified format * docs: update
This commit is contained in:
parent
60b899d9bc
commit
15df7739dd
@ -123,43 +123,43 @@ tree/draggable
|
||||
|
||||
## Attributes
|
||||
|
||||
| Name | Description | Type | Accepted Values | Default |
|
||||
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | --------------- | ------- |
|
||||
| data | tree data | array | — | — |
|
||||
| empty-text | text displayed when data is void | string | — | — |
|
||||
| node-key | unique identity key name for nodes, its value should be unique across the whole tree | string | — | — |
|
||||
| props | configuration options, see the following table | object | — | — |
|
||||
| render-after-expand | whether to render child nodes only after a parent node is expanded for the first time | boolean | — | true |
|
||||
| load | method for loading subtree data, only works when `lazy` is true | function(node, resolve, reject) | — | — |
|
||||
| render-content | render function for tree node | Function(h, `{ node, data, store }`) | — | — |
|
||||
| highlight-current | whether current node is highlighted | boolean | — | false |
|
||||
| default-expand-all | whether to expand all nodes by default | boolean | — | false |
|
||||
| expand-on-click-node | whether to expand or collapse node when clicking on the node, if false, then expand or collapse node only when clicking on the arrow icon. | boolean | — | true |
|
||||
| check-on-click-node | whether to check or uncheck node when clicking on the node, if false, the node can only be checked or unchecked by clicking on the checkbox. | boolean | — | false |
|
||||
| auto-expand-parent | whether to expand father node when a child node is expanded | boolean | — | true |
|
||||
| default-expanded-keys | array of keys of initially expanded nodes | array | — | — |
|
||||
| show-checkbox | whether node is selectable | boolean | — | false |
|
||||
| check-strictly | whether checked state of a node not affects its father and child nodes when `show-checkbox` is `true` | boolean | — | false |
|
||||
| default-checked-keys | array of keys of initially checked nodes | array | — | — |
|
||||
| current-node-key | key of initially selected node | string / number | — | — |
|
||||
| filter-node-method | this function will be executed on each node when use filter method. if return `false`, tree node will be hidden. | Function(value, data, node) | — | — |
|
||||
| accordion | whether only one node among the same level can be expanded at one time | boolean | — | false |
|
||||
| indent | horizontal indentation of nodes in adjacent levels in pixels | number | — | 18 |
|
||||
| icon | custom tree node icon component | `string \| Component` | — | — |
|
||||
| lazy | whether to lazy load leaf node, used with `load` attribute | boolean | — | false |
|
||||
| draggable | whether enable tree nodes drag and drop | boolean | — | false |
|
||||
| allow-drag | this function will be executed before dragging a node. If `false` is returned, the node can not be dragged | Function(node) | — | — |
|
||||
| allow-drop | this function will be executed before the dragging node is dropped. If `false` is returned, the dragging node can not be dropped at the target node. `type` has three possible values: 'prev' (inserting the dragging node before the target node), 'inner' (inserting the dragging node to the target node) and 'next' (inserting the dragging node after the target node) | Function(draggingNode, dropNode, type) | — | — |
|
||||
| Name | Description | Type | Default |
|
||||
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------- |
|
||||
| data | tree data | ^[Array] | — |
|
||||
| empty-text | text displayed when data is void | ^[string] | — |
|
||||
| node-key | unique identity key name for nodes, its value should be unique across the whole tree | ^[string] | — |
|
||||
| props | configuration options, see the following table | [props](#props) | — |
|
||||
| render-after-expand | whether to render child nodes only after a parent node is expanded for the first time | ^[boolean] | true |
|
||||
| load | method for loading subtree data, only works when `lazy` is true | ^[Function]`(node, resolve, reject) => void` | — |
|
||||
| render-content | render function for tree node | ^[Function]`(h, { node, data, store }) => void` | — |
|
||||
| highlight-current | whether current node is highlighted | ^[boolean] | false |
|
||||
| default-expand-all | whether to expand all nodes by default | ^[boolean] | false |
|
||||
| expand-on-click-node | whether to expand or collapse node when clicking on the node, if false, then expand or collapse node only when clicking on the arrow icon. | ^[boolean] | true |
|
||||
| check-on-click-node | whether to check or uncheck node when clicking on the node, if false, the node can only be checked or unchecked by clicking on the checkbox. | ^[boolean] | false |
|
||||
| auto-expand-parent | whether to expand father node when a child node is expanded | ^[boolean] | true |
|
||||
| default-expanded-keys | array of keys of initially expanded nodes | ^[object]`Array<string \| number>` | — |
|
||||
| show-checkbox | whether node is selectable | ^[boolean] | false |
|
||||
| check-strictly | whether checked state of a node not affects its father and child nodes when `show-checkbox` is `true` | ^[boolean] | false |
|
||||
| default-checked-keys | array of keys of initially checked nodes | ^[object]`Array<string \| number>` | — |
|
||||
| current-node-key | key of initially selected node | ^[string] / ^[number] | — |
|
||||
| filter-node-method | this function will be executed on each node when use filter method. if return `false`, tree node will be hidden. | ^[Function]`(value, data, node) => boolean` | — |
|
||||
| accordion | whether only one node among the same level can be expanded at one time | ^[boolean] | false |
|
||||
| indent | horizontal indentation of nodes in adjacent levels in pixels | ^[number] | 18 |
|
||||
| icon | custom tree node icon component | ^[string] / ^[Component] | — |
|
||||
| lazy | whether to lazy load leaf node, used with `load` attribute | ^[boolean] | false |
|
||||
| draggable | whether enable tree nodes drag and drop | ^[boolean] | false |
|
||||
| allow-drag | this function will be executed before dragging a node. If `false` is returned, the node can not be dragged | ^[Function]`(node) => boolean` | — |
|
||||
| allow-drop | this function will be executed before the dragging node is dropped. If `false` is returned, the dragging node can not be dropped at the target node. `type` has three possible values: 'prev' (inserting the dragging node before the target node), 'inner' (inserting the dragging node to the target node) and 'next' (inserting the dragging node after the target node) | ^[Function]`(draggingNode, dropNode, type) => boolean` | — |
|
||||
|
||||
## props
|
||||
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| --------- | ----------------------------------------------------------------------------- | ---------------------------- | --------------- | ------- |
|
||||
| label | specify which key of node object is used as the node's label | string, function(data, node) | — | — |
|
||||
| children | specify which node object is used as the node's subtree | string | — | — |
|
||||
| disabled | specify which key of node object represents if node's checkbox is disabled | string, function(data, node) | — | — |
|
||||
| isLeaf | specify whether the node is a leaf node, only works when lazy load is enabled | string, function(data, node) | — | — |
|
||||
| class | custom node class name | string, function(data, node) | — | — |
|
||||
| Attribute | Description | Type | Default |
|
||||
| --------- | ----------------------------------------------------------------------------- | ------------------------------------------------ | ------- |
|
||||
| label | specify which key of node object is used as the node's label | ^[string] / ^[Function]`(data, node) => string` | — |
|
||||
| children | specify which node object is used as the node's subtree | ^[string] | — |
|
||||
| disabled | specify which key of node object represents if node's checkbox is disabled | ^[string] / ^[Function]`(data, node) => boolean` | — |
|
||||
| isLeaf | specify whether the node is a leaf node, only works when lazy load is enabled | ^[string] / ^[Function]`(data, node) => boolean` | — |
|
||||
| class | custom node class name | ^[string] / ^[Function]`(data, node) => string` | — |
|
||||
|
||||
## Method
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user