links 添加到 sub 后删除自身
This commit is contained in:
@@ -38,9 +38,14 @@ let utils = {
|
|||||||
|
|
||||||
// 递归
|
// 递归
|
||||||
if (obj.links != undefined) {
|
if (obj.links != undefined) {
|
||||||
obj.links.forEach(item => {
|
obj.links.forEach((item, index, arr) => {
|
||||||
// 添加到子路径(适配 Element UI - Tree)
|
// 添加到子路径(适配 Element UI - Tree)
|
||||||
obj.sub.push(item);
|
obj.sub.push(item);
|
||||||
|
|
||||||
|
// 删除自身
|
||||||
|
if (index === (arr.length - 1)) {
|
||||||
|
delete obj.links;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +54,7 @@ let utils = {
|
|||||||
obj.sub.forEach(item => {
|
obj.sub.forEach(item => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fn(item);
|
fn(item);
|
||||||
}, 10 * currentIndex);
|
}, 20 * currentIndex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user