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

当a-demo模块禁用时,自动禁用菜单项 #6

Closed
zhennann opened this issue Jun 14, 2024 · 0 comments
Closed

当a-demo模块禁用时,自动禁用菜单项 #6

zhennann opened this issue Jun 14, 2024 · 0 comments

Comments

@zhennann
Copy link
Contributor

zhennann commented Jun 14, 2024

Video

issue消消乐:禁用demo模块

场景诉求

  1. a-demo模块允许禁用。但是当a-demo模块禁用后,仍然显示a-demo中的菜单项。这样,当点击菜单项时,找不到对应的页面组件
  2. 希望a-demo模块禁用后,不显示a-demo中的菜单项

方案分析

  1. 是否有一个机制,可以判断某个模块是否存在
  2. 如果可以判断模块是否存在,就可以在获取到菜单项后,进行过滤操作

开发任务

  1. 如何禁用模块
  • npm run build/preview查看效果
  • 顺便演示页面导航时异步加载模块的机制
  1. 模块元数据
  2. 增加module.exists方法:判断模块是否存在
  3. 对获取的菜单项进行过滤
  • 通过url来查找模块名称的方法在导航守卫中出现过
  1. 将判断path有效性的逻辑提炼为:$router.checkPathValid
@zhennann zhennann changed the title 当a-demo套件禁用时,自动禁用菜单项 当a-demo模块禁用时,自动禁用菜单项 Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant