Feature: Added toggle() method to the node passed to TreeNode.click() handler.

This commit is contained in:
Barry Jones
2020-09-08 15:35:17 +01:00
parent 5500a36492
commit 0f04f7edba
2 changed files with 5 additions and 2 deletions

View File

@@ -219,7 +219,7 @@ Or just register locally like the example below.
| name | params | description |
| :---------: | :--------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| click | TreeNode | Trigger when clicking a tree node |
| click | TreeNode | Trigger when clicking a tree node. You can call `toggle` of `TreeNode` to toggle the folder node. |
| change-name | {'id', 'oldName', 'newName'} | Trigger after changing a node's name |
| delete-node | TreeNode | Trigger when clicking `delNode` button. You can call `remove` of `TreeNode` to remove the node. |
| add-node | TreeNode | Trigger after adding a new node |

View File

@@ -272,7 +272,10 @@ export default {
},
click() {
this.rootNode.$emit('click', this.model)
this.rootNode.$emit('click', {
toggle: this.toggle,
...this.model
})
},
addChild(isLeaf) {