- directory tree initialization initially returns only a two-tier structure.
[
{
name: "",
path: "/",
id: 1,
childs: 2,
children: [
{
name: "01",
path: "/01/",
id: 2,
childs: 2,
children:null
},
{
name: "02",
path: "/02/",
id: 3,
childs: 1,
children:null
},
]
}
]
when a node is clicked, it is expanded by whether the id and childs clicked are the child nodes under the current node 0 and add expanded: true,.
now the opening path is path: "all / first-level menu 01 / second-level menu 02 / third-level menu 04"
how to match to all / first-level menu 01 /
in the initialization directory tree through this path. Get children, through id to match all / first-level menu 01 / second-level menu 02 /
get children, through id Match all / level 1 menus 01 / level 2 menus 02 / level 3 menus 04
in children, and expand it?
the idea is to use the path all / level 1 menus 01 / level 2 menus 02 / level 3 menus 04
to include Path in the first level matching tree.
Thank you.