如何使用filter方法递归过滤Tree数组对象
```
const treeData = [{
  title: "1",
  key: "1",
  children: [{
    title: "1-1",
    key: "1-1",
    children:[{
      title:"1-1-1",
      key:"1-1-1",
    },{
      title:"1-1-2",
      key:"1-1-2",
    }]
  }, {
    title: "1-2",
    key: "1-2",
  },{
    title: "1-3",
    key: "1-3",
  },{
    title: "1-4",
    key: "1-4",
  }],
}];

```
想要实现通过传入的key，过滤树，如果父级被过滤掉，该父级下面所有子级也全部被过滤。
我通过递归map,还有递归filter都没有实现过滤的效果。代码如下：
```
deleteTreeData = (data,selectedKey) => {
    const newTreeData = data.filter((item) => {
      if(item.children){
        this.deleteTreeData(item.children,selectedKey);
      }

      return item.key !== selectedKey;

    });

    this.setState({
      treeData : newTreeData,
    },function(){
      console.log("=====newTreeData："+JSON.stringify(newTreeData));
    });
  }

```
这样写只能删除顶级菜单，请问正确的思路是什么，谢谢~
```
const treeData = [{
  title: "1",
  key: "1",
  children: [{
    title: "1-1",
    key: "1-1",
    children:[{
      title:"1-1-1",
      key:"1-1-1",
    },{
      title:"1-1-2",
      key:"1-1-2",
    }]
  }, {
    title: "1-2",
    key: "1-2",
  },{
    title: "1-3",
    key: "1-3",
  },{
    title: "1-4",
    key: "1-4",
  }],
}];

function f(arr, selectedKey) {
  return arr.filter(item => item.key !== selectedKey).map(item => {
    item = Object.assign({}, item)
    if (item.children) {
      item.children = f(item.children, selectedKey)
    }
    return item
  })
}

console.log(f(treeData, '1-2'))
```