Skip to content

Commit

Permalink
Merge pull request zuiidea#844 from JChord/master
Browse files Browse the repository at this point in the history
refactor:修改父ID取值逻辑
  • Loading branch information
superlbr authored Jun 25, 2018
2 parents 6dffa73 + 69571f2 commit 737c023
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/Layout/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ const Menus = ({
let result = [String(current[id])]
const getPath = (item) => {
if (item && item[pid]) {
result.unshift(String(item[pid]))
getPath(queryArray(array, item[pid], id))
if (item[pid] === '-1') {
result.unshift(String(item['bpid']))
} else {
result.unshift(String(item[pid]))
getPath(queryArray(array, item[pid], id))
}
}
}
getPath(current)
Expand All @@ -111,8 +115,6 @@ const Menus = ({

if (!defaultSelectedKeys) {
defaultSelectedKeys = ['1']
} else if(defaultSelectedKeys[0] === '-1') {
defaultSelectedKeys = [defaultSelectedKeys[1].toString()[0]]
}

return (
Expand Down

0 comments on commit 737c023

Please sign in to comment.