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

新功能建议: 优化顶栏菜单在配置文件中的写法 #133

Closed
2 tasks done
Candinya opened this issue Jun 12, 2022 · 4 comments
Closed
2 tasks done

新功能建议: 优化顶栏菜单在配置文件中的写法 #133

Candinya opened this issue Jun 12, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Candinya
Copy link
Owner

Candinya commented Jun 12, 2022

  1. 报告前须知
  • 我已确认该功能确实不存在
  • 我会认真详细地描述清楚我想要的功能
  1. 您的新功能建议是由使用时出现的不便引发的吗?

是,因为原来这种 object 写法是在完全不懂 yaml 语法时候瞎整出来的,现在觉得实在太难看了

  1. 请描述您所设想的功能或是解决方案

改成如下的写法:

topMenu:
- label: 首页
icon: home
url: /
- label: 档案馆
icon: file
url: /archives/
- label: 好伙伴
icon: paw
url: /friends/
- label: 链接
icon: link
submenu:
- label: 作者博客
url: https://candinya.com
- label: 项目链接
url: https://github.com/Candinya/Kratos-Rebirth

每一项的含义解释:

- label: 这个菜单的标签文字
  icon: 这个菜单前的图标(在 FontAwesome 4.7.0 图标库中选择,可以不设置)
  url: 这个菜单指向的链接(站内或是站外均可)
  submenu: 这个菜单是否为一个二级菜单,有了这个选项就会忽略上面的 url
    - label: 二级菜单项的标签文字 
      icon: 二级菜单前的图标(在 FontAwesome 4.7.0 图标库中选择,可以不设置)
      url: 二级菜单项指向的链接
  1. 补充内容:
  1. 一级菜单中如果有 submenu 就会无视 url ,没有就会作为单独一项的 url
  2. 保留向下兼容性,如果 topMenu 配置项存在则覆盖老一套的配置逻辑,不存在就还是使用老一套的;会在下一个 major 版本去掉旧的支持
@Candinya Candinya added the enhancement New feature or request label Jun 12, 2022
@Candinya Candinya self-assigned this Jun 12, 2022
@ArcticLampyrid
Copy link
Collaborator

可以再加个 icon: string

@Candinya
Copy link
Owner Author

可以再加个 icon: string

有道理,强调一下 icon 的重要性 😯

Candinya added a commit that referenced this issue Jun 27, 2022
@Candinya
Copy link
Owner Author

Candinya commented Jul 4, 2022

(因为看到有人问哪里去找图标但找不到那条回复所以在这里附一下)
FontAwesome 4.7.0 的图标可以去 https://fontawesome.com/v4/icons/ 这里找到(我知道它很老了)

@Candinya Candinya pinned this issue Jul 4, 2022
@ArcticLampyrid
Copy link
Collaborator

ArcticLampyrid commented Jul 4, 2022 via email

@Candinya Candinya added this to the v3 milestone Feb 2, 2023
@Candinya Candinya unpinned this issue May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants