Function getTreeCheckNodes

  • 主动获取树的半选/全选节点

    Parameters

    • treeData: any[]

      树值

    • checkedKeys: string[]

      已经全选的节点

    • halfCheckedKeys: string[] = []

      已经半选的节点

    • fieldNames: {
          children?: string;
          key?: string;
      } = ...

      自定义字段名

      • Optionalchildren?: string
      • Optionalkey?: string

    Returns {
        checkedNodes: never[];
        halfCheckedNodes: never[];
        nodeArr: never[];
        nodeMap: Map<any, any>;
        nodeObj: {};
        parentMap: Map<any, any>;
    } | {
        checkedNodes: string[];
        halfCheckedNodes: string[];
        nodeArr: any[];
        nodeMap: Map<string, any>;
        nodeObj: Record<string, any>;
        parentMap: Map<string, string>;
    }

    getTreeCheckNodes(treeData, ['0-0', '0-1']); /// ...
    getTreeCheckNodes(treeData, ['0-0', '0-1'], ['0']); /// ...
    getTreeCheckNodes(treeData, ['0-0', '0-1'], ['0'], { key: 'id' }); /// 使用 id 作为唯一标识