wsfe / vue-tree

使用虚拟列表优化的 Vue 树组件 Vue tree component optimized using virtual list
https://wsfe.github.io/vue-tree/
MIT License
176 stars 32 forks source link

在append 和 prepend 节点到tree上时,报错 #81

Closed pepesi closed 9 months ago

pepesi commented 9 months ago

Bug 描述 tree.value.prepend 和 tree.value.append报错,TypeError: Cannot read properties of undefined (reading 'id')

我在ui上新建了一个node,然后再向这个node append或者prepend更多子node的时候,就报错了

似乎和这儿有关 https://github.com/wsfe/vue-tree/blob/26b2b5045d58432849fc0c22ccfcde402f440e28/src/store/tree-store.ts#L710

https://github.com/wsfe/vue-tree/blob/26b2b5045d58432849fc0c22ccfcde402f440e28/src/store/tree-store.ts#L734C20-L734C28

这里的代码,当parentnode的children为空的时候,这里就会异常。