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

How to have a root single node

Open kowiste opened this issue 4 years ago • 1 comments
trafficstars

Hi, I'm trying to have a tree in which all the nodes have to be hanging from a single root node. You can see the data below, in the id 1 I set draggable to false, so can't be modify, but I still can drop a node in the same level that this node, there is any way to disable this?

{ treeData: [ { id: 1, text: "root", isRoot: true, $draggable: false, children: [ { id: 2, text: "node 2", isRoot: false, $draggable: true, $droppable: true, }, { id: 3, text: "node 2-1", isRoot: false, $draggable: true, $droppable: true, }, { id: 4, text: "node 2-2", isRoot: false, $draggable: true, $droppable: true, }, ], }, ], };

kowiste avatar Feb 24 '21 04:02 kowiste

There is a prop rootNode, https://he-tree-vue.phphe.com/api.html#rootnode You may need:

<Tree :rootNode="{$droppable: false}">

phphe avatar Feb 24 '21 13:02 phphe