mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
13 lines
289 B
JavaScript
13 lines
289 B
JavaScript
|
export function findMenuValue (options, path) {
|
||
|
for (const option of options) {
|
||
|
if (option.children) {
|
||
|
const value = findMenuValue(option.children, path)
|
||
|
if (value) return value
|
||
|
}
|
||
|
if (option.path === path) {
|
||
|
return option.key
|
||
|
}
|
||
|
}
|
||
|
return undefined
|
||
|
}
|