标签:pre unshift span property == shift func cti tree
1 function recursionTreeId(_arr, _id) { 2 _arr.forEach(item => { 3 if (item.id === _id) { 4 optionArr.unshift(item.id); 5 if (item.pid) { 6 // 如果有父级 7 recursionTreeId(arr, item.pid); 8 } 9 } else if (item.hasOwnProperty("children")) { 10 recursionTreeId(item.children, _id); 11 } 12 }); 13 } 14 recursionTreeId(arr, _id);
标签:pre unshift span property == shift func cti tree
原文地址:https://www.cnblogs.com/chenzeyongjsj/p/10951492.html