mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
docs: update tree->draggable demo forEach (#23055)
This commit is contained in:
parent
cde4c1a749
commit
0b8cc13a07
@ -66,14 +66,14 @@ class Demo extends React.Component {
|
||||
const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
||||
|
||||
const loop = (data, key, callback) => {
|
||||
data.forEach((item, index, arr) => {
|
||||
if (item.key === key) {
|
||||
return callback(item, index, arr);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].key === key) {
|
||||
return callback(data[i], i, data);
|
||||
}
|
||||
if (item.children) {
|
||||
return loop(item.children, key, callback);
|
||||
if (data[i].children) {
|
||||
loop(data[i].children, key, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const data = [...this.state.gData];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user