N00ts / vue3-treeview

a simple treeview in vue js 3
MIT License
71 stars 61 forks source link

How to handle drag events? #32

Closed hirisov closed 1 year ago

hirisov commented 1 year ago

Hello,

I try to understand how to handle drag events. I would like to detect when the drag is over, and send a request to a backend API to update the tree. From the docs it seems to me the event should have a dragged and a target key. As I test I try to drag a node which has the id of: id6 In the node-dragend callback I console.log the whole event, and it seems to me both

event.target.node and event.dragged.node.id

cointans the same value (id6), and I cannot find any info in the event which shows where (after or inside which node) I dragged the item.

Can somebody please show a minimal example on how to detect properly after or inside which node the drag ended?

Akkanura commented 1 year ago

Hello,

I'd like to know that too.

Thanks!

N00ts commented 1 year ago

In my case (the one one the repo dev.Vue) this is working fine.

you have a.target.node and a.dragged.node.id

If you want to try, you can:

If it does not work as expected, can you provide reproduction environment ?

Regards