el-tree获取选中节点
时间: 2023-08-23 21:14:34 浏览: 216
ElementUI中el-tree节点的操作的实现
要获取el-tree中选中的节点,可以使用$refs来引用el-tree组件,然后调用getCheckedNodes()方法或getCheckedKeys()方法。例如,在代码中使用ref属性给el-tree组件命名为"tree",然后可以通过this.$refs.tree.getCheckedNodes()来获取选中的节点数组,或者使用this.$refs.tree.getCheckedKeys()来获取选中的节点的key数组。\[1\] \[2\] \[3\]
#### 引用[.reference_title]
- *1* *3* [element:el-tree控件获取当前选中节点(key)值](https://blog.csdn.net/Aoutlaw/article/details/122963769)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [element:el-tree控件获取当前选中节点(key)值,超简单!!](https://blog.csdn.net/qq_37385617/article/details/112317199)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文