Skip to content

Components.Tree:Document sample judgment error @drop=ondrop #5801

@shuimupj

Description

@shuimupj
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.0-beta.2

Environment

chrome

Reproduction link

https://www.antdv.com/components/tree-cn#components-tree-demo-draggable

Steps to reproduce

文档的“Tree 树形控件”参考案例中拖动示例代码

const onDrop = info => {
...
if (!info.dropToGap) {
...
} else if (
(info.node.children || []).length > 0 && // Has children
info.node.expanded && // Is expanded
dropPosition === 1 // On the bottom gap
) {
...
} else {
...
}
...
}

其中info.node.children判断是否有误?

@drop的回调参数{event, node, dragNode, dragNodesKeys}中node下面没有children,只有一个dataRef且会包含children

What is expected?

能否解释一下else if的逻辑作用

What is actually happening?

@drop=onDrop 的回调参数info, info.node下并无children

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions