mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
parent
38a7a87690
commit
2190f63959
@ -61,6 +61,8 @@ class Demo extends React.Component {
|
||||
console.log(info);
|
||||
const dropKey = info.node.props.eventKey;
|
||||
const dragKey = info.dragNode.props.eventKey;
|
||||
const dropPos = info.node.props.pos.split('-');
|
||||
const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
||||
// const dragNodesKeys = info.dragNodesKeys;
|
||||
const loop = (data, key, callback) => {
|
||||
data.forEach((item, index, arr) => {
|
||||
@ -85,7 +87,11 @@ class Demo extends React.Component {
|
||||
ar = arr;
|
||||
i = index;
|
||||
});
|
||||
ar.splice(i, 0, dragObj);
|
||||
if (dropPosition === -1) {
|
||||
ar.splice(i, 0, dragObj);
|
||||
} else {
|
||||
ar.splice(i - 1, 0, dragObj);
|
||||
}
|
||||
} else {
|
||||
loop(data, dropKey, (item) => {
|
||||
item.children = item.children || [];
|
||||
|
Loading…
Reference in New Issue
Block a user