• 循环遍历树形数据返回符合条件的节点

    Type Parameters

    • T = any

    Parameters

    • treeData: T[]

      树形数据

    • opt: {
          children?: string;
          conversion: Fn<any>;
      }

      树形的配置项

      • Optional children?: string
      • conversion: Fn<any>

    Returns T[]

    Example

    const tree = [{value: 1, id: 1, children: [{value: 2, pid: 1, id: 2, children: [{value: 3, pid: 2, id: 3}]}]}]
    const nodes = treeMap(tree, {
    conversion: (node) => {
    if (node.value === 3) {
    return node
    }
    }
    })

Generated using TypeDoc