vtils

Home > utils > TreeData > setNodeProps

TreeData.setNodeProps() method

设置节点属性。

Signature:

setNodeProps<TProps extends {
        [K in keyof TNode]?: (payload: TreeDataTraverseFnPayload<TNode>) => any;
    } & {
        [K: string]: (payload: TreeDataTraverseFnPayload<TNode>) => any;
    }>(props: TProps): TreeData<Merge<TNode, {
        [K in keyof TProps]: ReturnType<TProps[K]>;
    }>>;

Parameters

Parameter Type Description
props TProps 节点属性键值映射对象,值为函数,用其返回值作为新的属性值

Returns:

TreeData<Merge<TNode, { [K in keyof TProps]: ReturnType<TProps[K]>; }>>