feat
This commit is contained in:
@@ -44,12 +44,10 @@ export function loadViewComponent(componentPath: string) {
|
||||
}
|
||||
// 构建完整的文件路径
|
||||
const filePath = `/src/views/${normalizedPath}.vue`
|
||||
console.log('filePath', filePath)
|
||||
|
||||
// 从预加载的模块中查找
|
||||
const modulePath = Object.keys(viewModules).find((path) => path.endsWith(filePath) || path === filePath)
|
||||
|
||||
console.log('modulePath', modulePath)
|
||||
|
||||
if (modulePath && viewModules[modulePath]) {
|
||||
return viewModules[modulePath]
|
||||
}
|
||||
@@ -98,7 +96,6 @@ export function transformMenuToRoutes(menuItems: ServerMenuItem[]): AppRouteReco
|
||||
// 传递父级的 component 和 path 给子路由处理函数
|
||||
route.children = transformChildRoutes(item.children, item.component, item.menu_path)
|
||||
} else if (item.component) {
|
||||
console.log('menu item component:', item.component)
|
||||
// 一级菜单没有 children 但有 component,创建一个空路径的子路由
|
||||
const routeName = route.name
|
||||
route.children = [
|
||||
@@ -171,7 +168,6 @@ function transformChildRoutes(
|
||||
return children.map((child) => {
|
||||
// 优先使用子菜单自己的 component,否则继承父级的 component
|
||||
const componentPath = child.component || parentComponent
|
||||
console.log('child component:', componentPath)
|
||||
// 计算子路由的相对路径
|
||||
const childFullPath = child.menu_path || child.path || ''
|
||||
const relativePath = extractRelativePath(childFullPath, parentPath || '')
|
||||
|
||||
Reference in New Issue
Block a user