mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-28 11:24:50 +00:00
refactor:修改父ID取值逻辑
This commit is contained in:
@@ -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)
|
||||
@@ -111,8 +115,6 @@ const Menus = ({
|
||||
|
||||
if (!defaultSelectedKeys) {
|
||||
defaultSelectedKeys = ['1']
|
||||
} else if(defaultSelectedKeys[0] === '-1') {
|
||||
defaultSelectedKeys = [defaultSelectedKeys[1].toString()[0]]
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user