function isIframe(url) {
|
return url.startsWith('/outside/iframe/')
|
}
|
const isNavigableMenuItem = (menuItem) => {
|
if (!menuItem.path || !menuItem.path.trim()) {
|
return false
|
}
|
if (!menuItem.meta?.isHide) {
|
return true
|
}
|
return menuItem.meta?.isFullPage === true
|
}
|
const normalizePath = (path) => {
|
return path.startsWith('/') ? path : `/${path}`
|
}
|
const getFirstMenuPath = (menuList) => {
|
if (!Array.isArray(menuList) || menuList.length === 0) {
|
return ''
|
}
|
for (const menuItem of menuList) {
|
if (!isNavigableMenuItem(menuItem)) {
|
continue
|
}
|
if (menuItem.children?.length) {
|
const childPath = getFirstMenuPath(menuItem.children)
|
if (childPath) {
|
return childPath
|
}
|
}
|
return normalizePath(menuItem.path)
|
}
|
return ''
|
}
|
export { getFirstMenuPath, isIframe, isNavigableMenuItem }
|