// 过滤 遍历 递归function filterTree(data) { var newTree = data.filter(x => x.type == '1') newTree.forEach(x => x.children && (x.children = filterTree(x.children))) return newTree;}