fix: force update css priority for sidebar

This commit is contained in:
sanbuphy
2026-01-12 21:07:35 +08:00
parent 49a92f466a
commit eaac9b5452
2 changed files with 15 additions and 62 deletions
+1 -49
View File
@@ -5,55 +5,7 @@ export default defineConfig({
title: 'Easy-Vibe Tutorial', title: 'Easy-Vibe Tutorial',
description: 'Easy-Vibe 中文实战课 - 零基础学会用 AI 干实际工作', description: 'Easy-Vibe 中文实战课 - 零基础学会用 AI 干实际工作',
head: [ head: [
['link', { rel: 'icon', href: '/logo.png' }], ['link', { rel: 'icon', href: '/logo.png' }]
[
'style',
{},
`
:root {
--vp-sidebar-nav-section-gap: 8px;
}
.VPSidebarItem.level-0 {
padding-bottom: 4px !important;
}
.VPSidebarItem.level-0 > .item {
padding-bottom: 2px !important;
}
.VPSidebarItem.level-1 .item,
.VPSidebarItem.level-2 .item,
.VPSidebarItem.level-3 .item,
.VPSidebarItem.level-4 .item {
padding-top: 2px !important;
padding-bottom: 2px !important;
min-height: 24px !important;
}
.VPSidebarGroup {
padding-top: 6px !important;
padding-bottom: 6px !important;
}
.VPSidebarItem.level-0 + .VPSidebarItem.level-1 {
margin-top: -2px !important;
}
.VPSidebarItem.level-0 .text {
line-height: 1.3 !important;
}
.VPSidebarItem.level-1 .text,
.VPSidebarItem.level-2 .text,
.VPSidebarItem.level-3 .text {
line-height: 1.4 !important;
padding: 0 !important;
}
.VPSidebarItem .VPLink {
padding-top: 2px !important;
padding-bottom: 2px !important;
min-height: auto !important;
}
.VPSidebarItem .item {
padding-top: 2px !important;
padding-bottom: 2px !important;
}
`
]
], ],
themeConfig: { themeConfig: {
logo: '/logo.png', logo: '/logo.png',
+14 -13
View File
@@ -1,54 +1,55 @@
:root { :root {
/* Easy-Vibe Theme Fix v2025-01-12 */
/* 调整侧边栏分组之间的间距 */ /* 调整侧边栏分组之间的间距 */
--vp-sidebar-nav-section-gap: 8px; --vp-sidebar-nav-section-gap: 8px;
} }
/* 减少一级标题(如"前端开发")底部的间距 */ /* 减少一级标题(如"前端开发")底部的间距 */
.VPSidebarItem.level-0 { html .VPSidebarItem.level-0 {
padding-bottom: 4px !important; padding-bottom: 4px !important;
} }
/* 减少一级标题文字与下方子菜单的间距 */ /* 减少一级标题文字与下方子菜单的间距 */
.VPSidebarItem.level-0 > .item { html .VPSidebarItem.level-0 > .item {
padding-bottom: 2px !important; padding-bottom: 2px !important;
} }
/* 调整子菜单项之间的间距 - 针对所有层级 */ /* 调整子菜单项之间的间距 - 针对所有层级 */
.VPSidebarItem.level-1 .item, html .VPSidebarItem.level-1 .item,
.VPSidebarItem.level-2 .item, html .VPSidebarItem.level-2 .item,
.VPSidebarItem.level-3 .item, html .VPSidebarItem.level-3 .item,
.VPSidebarItem.level-4 .item { html .VPSidebarItem.level-4 .item {
padding-top: 2px !important; padding-top: 2px !important;
padding-bottom: 2px !important; padding-bottom: 2px !important;
min-height: 24px !important; /* 强制减小最小高度 */ min-height: 24px !important; /* 强制减小最小高度 */
} }
/* 针对可能存在的特定类名进行覆盖,确保紧凑 */ /* 针对可能存在的特定类名进行覆盖,确保紧凑 */
.VPSidebarGroup { html .VPSidebarGroup {
padding-top: 6px !important; padding-top: 6px !important;
padding-bottom: 6px !important; padding-bottom: 6px !important;
} }
/* 进一步压缩分组标题与第一项之间的间距 */ /* 进一步压缩分组标题与第一项之间的间距 */
.VPSidebarItem.level-0 + .VPSidebarItem.level-1 { html .VPSidebarItem.level-0 + .VPSidebarItem.level-1 {
margin-top: -2px !important; margin-top: -2px !important;
} }
/* 压缩分组标题本身的行高 */ /* 压缩分组标题本身的行高 */
.VPSidebarItem.level-0 .text { html .VPSidebarItem.level-0 .text {
line-height: 1.3 !important; line-height: 1.3 !important;
} }
/* 压缩子项的行高 */ /* 压缩子项的行高 */
.VPSidebarItem.level-1 .text, html .VPSidebarItem.level-1 .text,
.VPSidebarItem.level-2 .text, html .VPSidebarItem.level-2 .text,
.VPSidebarItem.level-3 .text { html .VPSidebarItem.level-3 .text {
line-height: 1.4 !important; line-height: 1.4 !important;
padding: 0 !important; /* 移除文字本身的内边距 */ padding: 0 !important; /* 移除文字本身的内边距 */
} }
/* 强制链接本身没有额外的边距 */ /* 强制链接本身没有额外的边距 */
.VPSidebarItem .VPLink { html .VPSidebarItem .VPLink {
padding-top: 2px !important; padding-top: 2px !important;
padding-bottom: 2px !important; padding-bottom: 2px !important;
min-height: auto !important; min-height: auto !important;