he-tree icon indicating copy to clipboard operation
he-tree copied to clipboard

希望可以增加在指定node的上方或下方增加平级node

Open seyeeL opened this issue 3 years ago • 3 comments

现在只有添加子级,增加平级比较麻烦

seyeeL avatar Aug 02 '22 09:08 seyeeL

addNode

(node: obj, parentId: number | string | null, index?: number): void;

第三参数是索引, 就是用来添加平级的

phphe avatar Aug 05 '22 07:08 phphe

可以完善一下文档吗,index具体指什么,是以当前节点为0,1是下一级,-1上一级,还是以当前节点的父级开始,1表示第一个,以此类推。

seyeeL avatar Aug 05 '22 08:08 seyeeL

index是普通数组索引. 要添加到目标后面, 就是目标在同级中的索引加1.

phphe avatar Aug 05 '22 09:08 phphe