mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-11-27 04:09:51 +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
|
|
}
|