Reputation: 26427
I use the ElementUI Tree via:
<el-tree
:data="data"
:props="defaultProps">
</el-tree>
According, to the documention a node-click
event gets emitted when a node is clicked. How do I listen to that event and start a function whenever that happens?
Upvotes: 0
Views: 538
Reputation: 562
Try as follows:
Template:
<el-tree
:data="data"
:props="defaultProps"
@node-click="handleNodeClick"
>
</el-tree>
JavaScript:
methods: {
handleNodeClick(data) {
console.log(data);
}
}
If you want to take a closer look at how it works: https://jsfiddle.net/ncgoswjm/
Bye!
Upvotes: 1