feat(顶栏): 顶栏导航加回「公告」,排在排名后面——首页只放置顶那条了,其它公告从这里进
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
30bff2acc4
commit
46b043999b
1 file changed
+7
-10
@@ -79,10 +79,9 @@ function renderIcon(icon: string) {
|
||||
* 顶栏导航的唯一一张表:桌面端渲染成一排纯文字,窄屏收进「菜单」下拉。
|
||||
* `key` 就是一级路径,用来判定高亮(见上面的 active)。
|
||||
*
|
||||
* 顺序是 自学 / 题目 / 提交 / 题单 / 比赛 / 排名。「自学」进自学首页(/learn),
|
||||
* 顺序是 自学 / 题目 / 提交 / 题单 / 比赛 / 排名 / 公告。「自学」进自学首页(/learn),
|
||||
* 两门课、接着学哪一课都在那儿挑,不再是下拉。提交留在一级:学生天天回来看自己交的结果,老师课上翻全班代码也走它。
|
||||
* 公告不上顶栏 —— 一年五六条、基本是版本更新,首页有公告卡片和「全部」入口;
|
||||
* 只有手机菜单里留一项(见 mobileMenus)。
|
||||
* 公告 2026-10-13 回到顶栏(用户要的):首页只放置顶那条了,别的公告得有个地方点得到。
|
||||
* 不用 n-menu:它横排每项固定占 100px,1280 宽的机房屏上会把顶栏挤成两行。
|
||||
*/
|
||||
interface NavLink {
|
||||
@@ -100,18 +99,16 @@ const navLinks = computed<NavLink[]>(() =>
|
||||
{ key: "problemset", label: "题单", to: "/problemset" },
|
||||
{ key: "contest", label: "比赛", to: "/contest" },
|
||||
{ key: "rank", label: "排名", to: "/rank" },
|
||||
{ key: "announcement", label: "公告", to: "/announcement" },
|
||||
].filter((link) => link.show !== false),
|
||||
)
|
||||
|
||||
const announcementLink: NavLink = { key: "announcement", label: "公告", to: "/announcement" }
|
||||
|
||||
const mobileMenus = computed<DropdownOption[]>(() => [
|
||||
...navLinks.value.map((link) => ({ label: link.label, key: link.key })),
|
||||
{ label: announcementLink.label, key: announcementLink.key },
|
||||
])
|
||||
const mobileMenus = computed<DropdownOption[]>(() =>
|
||||
navLinks.value.map((link) => ({ label: link.label, key: link.key })),
|
||||
)
|
||||
|
||||
function handleNavSelect(key: string) {
|
||||
const link = [...navLinks.value, announcementLink].find((item) => item.key === key)
|
||||
const link = navLinks.value.find((item) => item.key === key)
|
||||
if (link) router.push(link.to)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user