N00ts / vue3-treeview

a simple treeview in vue js 3
MIT License
73 stars 65 forks source link

Bug: method "insertIn" doesn't care if we drop node into another node which is in leaves array in config #14

Closed olsoncarsen closed 2 years ago

olsoncarsen commented 2 years ago

If we want to use drag and drop while async loading and there are some nodes without children, we put their ids into the leaves array in config. If we drag and drop into the node which is in leaves array, icon will not show and node id won't be removed from leaves array. Way to reproduce: drag node into the "text3" or "text4". Sandbox: https://codesandbox.io/s/async-forked-qq3mii?file=/src/App.vue

olsoncarsen commented 2 years ago

Screenshot 2022-04-07 at 9 44 36 PM

N00ts commented 2 years ago

Hello, i'm sorry i'm very busy right now, I will take a look as soon as I can.

olsoncarsen commented 2 years ago

It's alright

N00ts commented 2 years ago

Hey I wanted to have a look but I feel that your example is not working anymore can you create a new test case please :) ?

olsoncarsen commented 2 years ago

https://codesandbox.io/s/async-forked-qq3mii?file=/src/App.vue

olsoncarsen commented 2 years ago

@N00ts this should work, steps to reproduce: drag task3 into task4

N00ts commented 2 years ago

Hello, what you try to do is to handle "leaves" manually. The icon does not appear because you keep the id the drop target node in config.leaves. I modifed the project and put "node-drop" after insert event so you can handle it manually in this event.

Regards

olsoncarsen commented 2 years ago

@N00ts, okay. I'm closing this issue