/**
* 递归函数查找数组
*/
treeSearch(array, currentId) {
let n = array.length;
let arr = Array.from({ length: n }, (_, index) => index);
for (let i of arr) {
if (array[i].id === currentId) {
return array[i];
} else if (array[i].children && array[i].children.length) {
const result = this.treeSearch(array[i].children, currentId);
if (result) return result;
}
}
},