Tree: fix type definition (#12941)

pull/12936/head^2
ZSkycat 2018-09-30 14:32:50 +08:00 committed by hetech
parent 74827513d0
commit 7e29e1c66d
1 changed files with 11 additions and 2 deletions

13
types/tree.d.ts vendored
View File

@ -4,10 +4,18 @@ import { ElementUIComponent } from './component';
export interface TreeData {
id?: any;
label?: string;
disabled?: boolean;
isLeaf?: boolean;
children?: TreeData[];
}
export interface TreeProps {
label: string;
disabled: string;
isLeaf: string;
children: string;
}
export interface TreeNode<K, D> {
checked: boolean;
childNodes: TreeNode<K, D>[];
@ -25,6 +33,7 @@ export interface TreeNode<K, D> {
disabled: boolean;
icon: string;
key: K;
label: string;
nextSibling: TreeNode<K, D> | null;
previousSibling: TreeNode<K, D> | null;
}
@ -49,7 +58,7 @@ export declare class ElTree<K = any, D = TreeData> extends ElementUIComponent {
nodeKey: string;
/** Configuration options, see the following table */
props: object;
props: TreeProps;
/** Method for loading subtree data */
load: (data: D, resolve: Function) => void;
@ -216,7 +225,7 @@ export declare class ElTree<K = any, D = TreeData> extends ElementUIComponent {
*
* @param by node key or node data
*/
getNode(by: D | K): D;
getNode(by: D | K): TreeNode<K, D>;
/**
* Remove node by key or node data or node instance