After enabling override-default-node-click-behavior, the icon click function becomes disabled. Is there any solution to this? | Tree组件 开启override-default-node-click-behavior后,图标点击就失效了
#7309
Unanswered
resuscitate
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Brief
In Naive UI’s
<n-tree>orTreeSelectcomponents, when using the:override-default-node-click-behaviorprop and implementing a custom node click handler, clicking the triangle arrow (expand/collapse icon) no longer expands or collapses the tree node as expected. Instead, only the custom function is triggered, and the default expand/collapse logic does not occur.Example code:
Phenomenon
In real scenarios, users are accustomed to clicking the triangle icon to expand/collapse nodes. However, after configuring the
overridehandler, clicking either the node text or the triangle icon both trigger the customoverridefunction, and the triangle icon loses its default expand/collapse logic.Expectation
Is there a more elegant way to allow arrow icon expanding/collapsing under the
overrideprop? Or will there be future support to distinguish event zones (e.g., separate the arrow icon click from node label click)?Thank you!
———————————————————————————————————————————————————————————
问题简述
在 Naive UI 的 n-tree 或 TreeSelect 组件中,配置
:override-default-node-click-behavior属性并实现自定义节点点击行为后,三角箭头(展开收起图标)点击后无法展开/收起树节点,只会执行自定义方法,不会保持默认的展开逻辑。如下代码:
现象
实际使用中,用户习惯点击三角图标展开/收起节点,但配置 override 行为后,无论点击文本或三角图标,均走 override 方法,三角图标失去原有展开/收起的默认逻辑。
期望
请问有没有更优雅的办法优化 override 下箭头点击的展开/收起?或者未来会否支持事件区分?
感谢!
Beta Was this translation helpful? Give feedback.
All reactions