links 添加到 sub 后删除自身

This commit is contained in:
2021-02-27 14:46:21 +08:00
parent dc003cd291
commit 7506d5f52c

View File

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