mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 00:12:43 +08:00
fix: 修复 pathResolve 函数在 path 为空时返回 parentPath 的逻辑,避免拼接出错
This commit is contained in:
parent
9ac6017ccc
commit
1ee658fda5
@ -101,7 +101,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
|
||||
if (!route.children && route.parentId == 0 && route.component) {
|
||||
data.component = Layout
|
||||
data.meta = {
|
||||
hidden: meta.hidden,
|
||||
hidden: meta.hidden
|
||||
}
|
||||
data.name = toCamelCase(route.path, true) + 'Parent'
|
||||
data.redirect = ''
|
||||
@ -170,8 +170,9 @@ const generateRoutePath = (parentPath: string, path: string) => {
|
||||
}
|
||||
export const pathResolve = (parentPath: string, path: string) => {
|
||||
if (isUrl(path)) return path
|
||||
const childPath = path.startsWith('/') || !path ? path : `/${path}`
|
||||
return `${parentPath}${childPath}`.replace(/\/\//g, '/')
|
||||
if (!path) return parentPath // 修复 path 为空时返回 parentPath,避免拼接出错 https://t.zsxq.com/QVr6b
|
||||
const childPath = path.startsWith('/') ? path : `/${path}`
|
||||
return `${parentPath}${childPath}`.replace(/\/+/g, '/')
|
||||
}
|
||||
|
||||
// 路由降级
|
||||
|
Loading…
x
Reference in New Issue
Block a user