N00ts/vue3-treeview

Unable to use async on ALL rootitems

rjansen2573 opened this issue · 0 comments

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;
});