arco-design / arco-design-pro-vue

An out-of-the-box solution to quickly build enterprise-level applications based on Arco Design.
https://pro.arco.design
MIT License
1.35k stars 277 forks source link

关于路由侧边栏渲染问题 #76

Closed HavocZhang closed 2 years ago

HavocZhang commented 2 years ago

Basic Info

What is expected?

在渲染的时候,如何侧边栏只渲染一个a-menu-item出来,目前看貌似不支持

HavocZhang commented 2 years ago

类似下面的路由,我怎么侧边栏只显示AboutPage const dashboard: AppRouteModule = { path: '/about', name: 'About', component: LAYOUT, redirect: '/about/index', meta: { hideChildrenInMenu: true, icon: 'simple-icons:about-dot-me', title: t('routes.dashboard.about'), orderNo: 100000, }, children: [ { path: 'index', name: 'AboutPage', component: () => import('/@/views/sys/about/index.vue'), meta: { title: t('routes.dashboard.about'), icon: 'simple-icons:about-dot-me', hideMenu: true, }, }, ], };

export default dashboard;

sHow8e commented 2 years ago

@HavocZhang hi。目前的解决方案有两个。1、整个注释掉声明的children属性。2、src/components/menu/useMenuTree 中的34行把 “element.children = []”加上。下周会发布一个版本修复一下。3q

HavocZhang commented 2 years ago

@HavocZhang hi。目前的解决方案有两个。1、整个注释掉声明的children属性。2、src/components/menu/useMenuTree 中的34行把 “element.children = []”加上。下周会发布一个版本修复一下。3q

按照你说的第二个方法改过之后,还有个问题,就是侧边栏无法变为选中状态,期待修复更新,希望能增加一级和多级菜单的一个示例,这对开箱即用意义很大。

sHow8e commented 2 years ago

@HavocZhang 你说的菜单项无法变为选中状态?我这边经过测试是可以的。烦请告知复现一下。最后感谢一下相关建议哈。我们会尽力去进行完善哈。

HavocZhang commented 2 years ago

@HavocZhang 你说的菜单项无法变为选中状态?我这边经过测试是可以的。烦请告知复现一下。最后感谢一下相关建议哈。我们会尽力去进行完善哈。

下面是我的路由配置,按照这个配置菜单项无法变为选中状态,不知道是不是路由写的问题,如果不这么写,应该如何去写,感谢开源,开源工作者都是最棒的! export default { path: '/test', name: 'test', component: DEFAULT_LAYOUT, redirect: '/test/test2-1', meta: { locale: '测试', requiresAuth: true, icon: 'dashboard-outlined', order: 0, hideChildrenInMenu: true, }, children: [ { path: 'test2-1', name: 'test2-1', component: () => import('@/views/dashboard/workplace/index.vue'), meta: { locale: '工作台', requiresAuth: true, roles: ['*'], }, }, ], }

sHow8e commented 2 years ago

@HavocZhang hi 简单看了一下你的配置项。因为做了重定向,这时候的路由信息已经变成了test2-1的,名称对应不上所以无法变为选中状态。这部分目前需要自行去添加配置一个字段进行展示纠正,同时菜单也需要做对应的调整。 后续针对这个问题我再发版做个功能优化好了。3q

sHow8e commented 2 years ago

done