首页  >  问答  >  正文

javascript - 使用 antd Tree 组件的时候,如何在 onSelect 子节点的时候同时获取直接父节点的 key

使用 antd 的 Tree 组件的时候, 发现 API 中的 onSelect 方法可以获取点击的子节点的 key,但没有找到如何获取直接父节点的 key。
想问有什么好的办法解决?

暂时想到的办法是在 node.props.root 是 整个Tree 组件,其中的 props.children 中显示所有 children 信息,循环遍历找到当前选中节点。。。。有点太麻烦了。。。

伊谢尔伦伊谢尔伦2748 天前2589

全部回复(0)我来回复

暂无回复
  • 取消回复