N00ts / vue3-treeview

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

Unable to use async on ALL rootitems #26

Open rjansen2573 opened 1 year ago

rjansen2573 commented 1 year ago

If you want to load all rootitems async and therefore have no children defined on all items the openicon will not be dsiplayed because hideIcons will return true in this case. So there is no way to open the node and trigger nodeOpened. You can see this in your async example by removing the line: children: ["id11", "id12"],

I think there needs to be also a property loadAsync = true instead of checking only for children.

const hideIcons = computed(() => { for (const id of roots.value) { const node = state.nodes.value[id]; if (node.loadAsync==true || node.children && node.children.length > 0) { return false; } } return true; });