Skip to content
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

关于隐藏菜单问题 #325

Closed
zuihou opened this issue Feb 22, 2024 · 7 comments
Closed

关于隐藏菜单问题 #325

zuihou opened this issue Feb 22, 2024 · 7 comments

Comments

@zuihou
Copy link
Contributor

zuihou commented Feb 22, 2024

问题: 路由配置时, 如何设置某个菜单的子菜单全部是隐藏菜单?

描述:

消息中心       (1级菜单)
├── 消息管理   (2级菜单)
│   ├── 发布消息   (3级隐藏菜单)
│   ├── 查看消息消息 (3级隐藏菜单)

代码结构

views        
├── msgcenter
│   ├── msg
│    │   ├── index.vue
│    │   ├── msgview
│    │    │   ├── index.vue
│    │   ├── msgedit
│    │    │   ├── index.vue
│   ├── template

目前效果
image

如上图所示, “消息管理” 下级显示了2个菜单, 我希望:

  1. 点击 “消息管理” 进入 views/msgcenter/msg/index.vue
  2. “发布消息” 和 “查看消息” 菜单隐藏起来,不在左侧菜单显示出来
  3. 在任意页面,点击 “发布消息” 按钮,跳转到 views/msgcenter/msg/msgview/index.vue
  4. 在任意页面,点击 “查看消息” 按钮,跳转到 views/msgcenter/msg/msgedit/index.vue
  5. 左侧菜单能正常显示 消息中心和消息管理,且消息管理能点击后跳转到 步骤1 中的地址。

自己做过的一些尝试:

  1. “发布消息” 和 “查看消息” 加了hideInMenu: true后,程序会按照这个方式显示。“消息管理” 无法点击
image
@zuihou
Copy link
Contributor Author

zuihou commented Feb 22, 2024

vben 这个项目,有一个hideChildrenInMenu 参数能解决上述问题,不知道此框架能否解决

@Azir-11
Copy link
Member

Azir-11 commented Feb 22, 2024

在本项目的路由插件Elegant Router的设计理念中,页面逻辑与文件逻辑应该是区分开的,在文件树中msgview与msgedit也不应在msg之内,例如您可以将msgview与msgedit移动至上一级菜单中并设置隐藏

@zuihou
Copy link
Contributor Author

zuihou commented Feb 22, 2024

文件树中msgview与msgedit不应在msg之内可以调整,但在业务上:

消息管理是一个大功能,而发布消息、编辑消息、查看消息是 隶属于 消息管理的,
image

在权限隶属关系上来讲,当我给用户分配 发布消息、 编辑消息、查看 时, 一定是需要分配先分配 消息管理的。
image

假设现在我按照你的设计理念,将 消息管理、发布消息、编辑消息、查看消息 都平级存放了,我在分配权限时,就无法从隶属关系上进行控制, 管理员就可以只给用户分配 ”编辑消息“ 、”查看消息 “,而不分配” 消息管理“ 。
但你连消息管理菜单都没有,光有 ”编辑消息“ 功能,怎么编辑数据呢?

@zuihou
Copy link
Contributor Author

zuihou commented Feb 22, 2024

技术栈的设计都应该围绕着解决业务问题的,对于上述问题, 我有没有办法能修改你的源码来实现呢?

大概需要修改那些页面能给个提示吗

@Azir-11
Copy link
Member

Azir-11 commented Feb 22, 2024

隐藏全部子级菜单后menu还显示了下拉是bug,会在两天内修好

@honghuangdc
Copy link
Member

首先系统的路由是基于 Elegant Router, 不支持这种路由
截屏2024-02-23 21 24 48

其次按照菜单的设计分为 目录、菜单和按钮
目录下面可以为菜单,而菜单就是最后一级了,不存在菜单下面还有菜单

@honghuangdc
Copy link
Member

https://soybeanjs.cn/function/hide-child/one 参照这个菜单

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants