phphe / vue-draggable-nested-tree

Vue2 draggable tree component
https://hetree.phphe.com/
MIT License
344 stars 62 forks source link

Node Position Within Level #30

Closed fulopattila122 closed 5 years ago

fulopattila122 commented 5 years ago

First of all: cool component! :+1:

How can I obtain the position of a node within a level?

Example: I have 3 nodes: "Orange", "Banana" and "Kiwi" - all on the root level. I drag the Banana node to the first position; just before Orange. So the new order of the nodes will be "Banana", "Orange, "Kiwi". Using the @change handler, how can I obtain if Banana became the first node?

Thank you!

phphe commented 5 years ago

do you mean node index? node.parent.children.indexOf(node)

fulopattila122 commented 5 years ago

Yes, thanks!