// 获取所有父级ID
function getActiveMenuId(path, arr, paths) {
if (paths === undefined) {
paths = []
}
if(arr){
for (let i = 0; i < arr.length; i++) {
const tmpPath = paths.concat()
tmpPath.push(arr[i].id)
if (path === arr[i].path) {
return tmpPath
}
if (arr[i].children !== null) {
const findResult = getActiveMenuId(path, arr[i].children, tmpPath)
if (findResult) {
return findResult
}
}
}
}
}
// 调用
getActiveMenuId(path,arr)