Vue element tree component Custom Node content deletion Node does not update DOM problem

Prepaid graph. The element tree shown above can delete nodes

The process of deleting

is roughly to get the child node data through node.parent.data.children through the two received parameters node and data,
and then by traversing (const index = children.findIndex (d = > d.id = data.id)

get the index, of the node and execute children.splice (index, 1), which is exactly the same code but my DOM has not been updated (that is, it has not been deleted). I would like to ask the gods what"s going on. Thank you very much (it is useful to add, that is, delete or not update).

Jul.14,2021

I used JSON.parse (JSON.stringify (data)) to convert the entire deleted raw data.

my code:

remove(node, data) {
      const parent = node.parent;
      const children = parent.data.children || parent.data;
      const index = children.findIndex(d => d.id === data.id);
      children.splice(index, 1);
      this.treeData = JSON.parse(JSON.stringify(this.treeData))
    },

you need to take a look at your data structure. When I wrote it before, it was the same as you. Then I looked at the data and changed the children to const children = parent.childNodes | | parent instead of the official const children = parent.data.children | | parent.data and deal with

according to my own data structure.
Menu