@@ -683,14 +685,10 @@ Tree nodes can be initially expanded or checked
...
@@ -683,14 +685,10 @@ Tree nodes can be initially expanded or checked
### Custom node content
### Custom node content
The content of tree nodes can be customized, so you can add icons or buttons as you will
The content of tree nodes can be customized, so you can add icons or buttons as you will
:::warning
`Append` and `remove` do not change `data`
:::
::: demo Use `render-content` to assign a render function that returns the content of tree nodes. See Vue's documentation for a detailed introduction of render functions. Note that this demo can't run in jsfiddle because it doesn't support JSX syntax. In a real project, `render-content` will work if relevant dependencies are correctly configured.
::: demo Use `render-content` to assign a render function that returns the content of tree nodes. See Vue's documentation for a detailed introduction of render functions. Note that this demo can't run in jsfiddle because it doesn't support JSX syntax. In a real project, `render-content` will work if relevant dependencies are correctly configured.
```html
```html
<el-tree
<el-tree
:data="data2"
:data="data4"
:props="defaultProps"
:props="defaultProps"
show-checkbox
show-checkbox
node-key="id"
node-key="id"
...
@@ -705,7 +703,7 @@ The content of tree nodes can be customized, so you can add icons or buttons as
...
@@ -705,7 +703,7 @@ The content of tree nodes can be customized, so you can add icons or buttons as
exportdefault{
exportdefault{
data(){
data(){
return{
return{
data2:[{
data4:[{
id:1,
id:1,
label:'Level one 1',
label:'Level one 1',
children:[{
children:[{
...
@@ -748,18 +746,19 @@ The content of tree nodes can be customized, so you can add icons or buttons as
...
@@ -748,18 +746,19 @@ The content of tree nodes can be customized, so you can add icons or buttons as
@@ -939,7 +938,7 @@ Only one node among the same level can be expanded at one time.
...
@@ -939,7 +938,7 @@ Only one node among the same level can be expanded at one time.
| node-key | unique identity key name for nodes, its value should be unique across the whole tree | 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 | — | — |
| props | configuration options, see the following table | object | — | — |
| load | method for loading subtree data | function(node, resolve) | — | — |
| load | method for loading subtree data | function(node, resolve) | — | — |
| render-content | render function for tree node | Function(h, { node } | — | — |
| render-content | render function for tree node | Function(h, { node, data, store } | — | — |
| highlight-current | whether current node is highlighted | boolean | — | false |
| highlight-current | whether current node is highlighted | boolean | — | false |
| default-expand-all | whether to expand all nodes by default | 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. | — | true | |
| 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. | — | true | |