How does the tree of iview make the data transmitted in the background consistent with the structure of the official website?

how do the data formats of these two pictures correspond? It is said on the Internet that it can be realized by recursion? How to operate it exactly? Thank you for your advice!

Mar.16,2021

simply write a method:

resetTree (oldTree) {
            let newTree = oldTree.map(item => {
                if (item.children) {
                    return {
                        ...item,
                        title: item.name,
                        children: this.resetTree(item.children)
                    }
                } else {
                    return {
                        ...item,
                        title: item.name
                    }
                }
            })
            return newTree
        }
Menu