N00ts/vue3-treeview

How to handle drag events?

hirisov opened this issue · 2 comments

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?

Hello,

I'd like to know that too.

Thanks!

N00ts commented

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:

  • clone the repo.
  • (npm / yarn) install
  • (npm / yarn) run dev
  • catch an event from @node-over (current is log but you can put whatever method you like)

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

Regards