-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] layout 菜单错误 #266
Comments
feat: 希望重构路由这部分,写的不是很好。 可以用 hooks 重构下 |
getMenuData 以及 clearMenuItem 均可按照自己业务需求自行实现,并且也推荐自行实现。 主要是 Vue 的用法人人都不同,为了照顾大家自己的想法,没办法做到每个点都符合所有人 并且建议根上的路由都以 |
@sendya layout: "mix",
splitMenus: true 菜单是被隐藏,激活状态也是错误的。 源码,这里有问题 const flatMenuData = computed(
() =>
(hasFlatMenu.value && props.selectedKeys && getMenuFirstChildren(props.menuData, props.selectedKeys[0])) || []
);
export function getMenuFirstChildren(menus: MenuDataItem[], key?: string) {
return key === undefined ? [] : (menus[menus.findIndex((menu) => menu.path === key)] || {}).children || [];
} 解决问题
const matched = router.currentRoute.value.matched.concat();
// 我这首页的 name 是 “/”
baseState.selectedKeys = matched
.filter((r) => r.name !== "/")
.map((r) => r.path);
baseState.openKeys = matched
.filter((r) => r.path !== router.currentRoute.value.path)
.map((r) => r.path); |
数组的根级(第一级)应该是/开始,eslint 其实也会提示 |
确认一下你的 selectedKeys 是否在变更,selectedKeys 应该是从上往下选中了焦点中的菜单项
selectedKeys 应该是 ['/a', '/a/b', '/a/b/c'] 而不是 ['/a/b/c'] |
@sendya 能再帮我看下 openKeys 的问题吗。感觉这样写不是很好 |
请问pro-components-vue 菜单使用 ant-design-vue 图标为啥不显示,看例子使用的是自定义图标路径,怎么使用ant-design-vue的图标呢 |
🐛 Bug 描述 Bug description
path: "index"
看了下源码
// 代码使用了 to -> name 来跳转
也可能是一个常驻路由和业务路由分开的路由。
vue-element-admin
🏞 期望结果 Desired result
/
开头的建议使用 fullpath,其实 formatRelativePath 已经实现🚑 其他信息 Other information
The text was updated successfully, but these errors were encountered: