最近在编写后台管理系统,遇到需要elementUI tree 树形控件获取父节点ID,正常情况下只是获取选中的节点,没选中节点无法获取id.
这里经验分享
找到对应的获取id的位置,将获取elementUI tree 树形控件ID代码:this.$refs.tree.getCheckedKeys()
替换成 this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys())即可。无需修改源码。
在此要感谢这篇博主的思路https://blog.youkuaiyun.com/qq_37588752/article/details/80075551。