he-tree
he-tree copied to clipboard
Adding a node programmatically has bugs
Hello.
First let me tell you, your component is great!!!
I want to add a node programmatically to the root. Currently the addNode() method works, passing a simple object as parameter, but the new node is not reactive, I cannot expand or collapse it (e.g. lazy loading does not work)
I also tried adding the node to the original data pointed by treeData but then the lazy loading does not work either.
What is the right wat to add a node with code?
Yes, it works in Vue3, with bug in Vue2. After addNode called, try follow code make properties reactive.
Object.keys(node).forEach(key => {
this.$set(node, key, node[key])
});