How to add new child nodes according to the parent node in the element-ui tree table

for example, when I enter the page, I get first-level categories, such as data

.
data : [
    {
        id: "2",
        parentId: 1,
        name : ""
    },
    {
        id: "2",
        parentId: 1,
        name : "2"
    }
]

then query the API to the backend based on this id, such as the query to id=2, and then get the subordinate

.
[
    {
        id: "5",
        parentId: 2,
        name : ""
    },
    {
        id: "6",
        parentId: 2,
        name : "2"
    }
]

how to implement, how to insert the query into the parent class as his children


load the query lazily, which is automatically inserted by the tree control.
https://codeshelper.com/q/10.


if you only realize the fusion of parent and child data manually, it will be fine:

children.forEach(child => {
    let parent = data.find(item => item.id == child.parentId)
    parent && (parent.children || (parent.children = [])) && parent.children.push(child)
})
Menu