mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 08:22:41 +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) {
|
if (!route.children && route.parentId == 0 && route.component) {
|
||||||
data.component = Layout
|
data.component = Layout
|
||||||
data.meta = {
|
data.meta = {
|
||||||
hidden: meta.hidden,
|
hidden: meta.hidden
|
||||||
}
|
}
|
||||||
data.name = toCamelCase(route.path, true) + 'Parent'
|
data.name = toCamelCase(route.path, true) + 'Parent'
|
||||||
data.redirect = ''
|
data.redirect = ''
|
||||||
@ -170,8 +170,9 @@ const generateRoutePath = (parentPath: string, path: string) => {
|
|||||||
}
|
}
|
||||||
export const pathResolve = (parentPath: string, path: string) => {
|
export const pathResolve = (parentPath: string, path: string) => {
|
||||||
if (isUrl(path)) return path
|
if (isUrl(path)) return path
|
||||||
const childPath = path.startsWith('/') || !path ? path : `/${path}`
|
if (!path) return parentPath // 修复 path 为空时返回 parentPath,避免拼接出错 https://t.zsxq.com/QVr6b
|
||||||
return `${parentPath}${childPath}`.replace(/\/\//g, '/')
|
const childPath = path.startsWith('/') ? path : `/${path}`
|
||||||
|
return `${parentPath}${childPath}`.replace(/\/+/g, '/')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 路由降级
|
// 路由降级
|
||||||
|
Loading…
x
Reference in New Issue
Block a user