diff --git a/src/layout/components/Menu/src/Menu.vue b/src/layout/components/Menu/src/Menu.vue index 2b96ea9f7..c32a4c2f3 100644 --- a/src/layout/components/Menu/src/Menu.vue +++ b/src/layout/components/Menu/src/Menu.vue @@ -52,7 +52,9 @@ export default defineComponent({ if(findRoutes){ findRoutes = JSON.parse(JSON.stringify(findRoutes)) findRoutes?.children?.forEach(item => { - item.path = findRoutes?.path+'/'+item.path + if(!isUrl(item.path)){ + item.path = findRoutes?.path+'/'+item.path + } }); } let homeRoute = allRoutes.find(item=>!item.meta.hidden&&item.path === '/') diff --git a/src/utils/is.ts b/src/utils/is.ts index 375298593..c5b9c26f0 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -97,7 +97,9 @@ export const isClient = !isServer export const isUrl = (path: string): boolean => { const reg = /(((^https?:(?:\/\/)?)(?:[-:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&%@.\w_]*)#?(?:[\w]*))?)$/ - return reg.test(path) + const urlPattern = /^(https?|ftp|file):\/\/[-\w]+(\.\w[-\w]*)+(:\d+)?(\/\S*)?$/ + + return urlPattern.test(path) } export const isDark = (): boolean => {