naive-ui/demo/utils/route.js

13 lines
289 B
JavaScript
Raw Normal View History

2021-04-05 17:59:04 +08:00
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
}