You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// 根据父级编号获取 父级的父级的子级
function getParent(tree , parentId ){ var menuList = [] var list = []; treeFindPath(tree,menuList); for (const menuListElement of menuList) { if(menuListElement.menuId == parentId){ for (const menuListElement1 of menuList) { if (menuListElement1.parentId == menuListElement.menuId){ list.push(menuListElement1); } } } }}
// 树形转 list
function treeFindPath(tree, path = []) { if (!tree) return [] for (const data of tree) { path.push(data) this.treeFindPath(data.list, path) } return path}
|