diff --git a/backend/app/service/doc_site.js b/backend/app/service/doc_site.js
index da0ff72..2d6413e 100644
--- a/backend/app/service/doc_site.js
+++ b/backend/app/service/doc_site.js
@@ -266,6 +266,7 @@ class DocSiteService extends Service {
const rendered = markdown.render(this.stripLeadingTitle(current.content, current.title));
const toc = rendered.toc.filter(item => item.level >= 2 && item.level <= 4);
+ const created = dateOnly(current.createdAt || current.created_at);
const updated = dateOnly(current.updatedAt || current.updated_at);
const summary = current.summary || markdown.plainText(current.content, 140);
@@ -273,7 +274,7 @@ class DocSiteService extends Service {
${escape(summary)}${escape(current.title)}
${summary ? `
最后更新:${updated}
` : ''} `; } @@ -347,21 +349,26 @@ ${this.styles()} --code-bg: #0f172a; } * { box-sizing: border-box; } -html, body { margin: 0; padding: 0; } +html, body { margin: 0; padding: 0; height: 100%; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: #fff; line-height: 1.75; font-size: 15px; + /* 页面本身不滚动,滚动条只出现在侧边栏与正文区 */ + display: flex; + flex-direction: column; + height: 100%; + overflow: hidden; } a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; } .topbar { - position: sticky; - top: 0; + position: relative; z-index: 10; + flex: 0 0 auto; display: flex; align-items: center; gap: 16px; @@ -409,14 +416,21 @@ a:hover { text-decoration: underline; } .layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); + grid-template-rows: minmax(0, 1fr); + flex: 1 1 auto; max-width: 1440px; + width: 100%; margin: 0 auto; - min-height: calc(100vh - 56px - 60px); + min-height: 0; + overflow: hidden; } .sidebar { padding: 24px 16px 40px; background: var(--side-bg); border-right: 1px solid var(--border); + min-height: 0; + overflow-y: auto; + overscroll-behavior: contain; } .side-head { font-size: 12px; @@ -445,7 +459,13 @@ a:hover { text-decoration: underline; } .side-link.is-active { background: var(--brand); color: #fff; } .side-empty { color: var(--text-muted); font-size: 13px; padding: 0 6px; } -.content { padding: 32px 40px 64px; min-width: 0; } +.content { + padding: 32px 40px 64px; + min-width: 0; + min-height: 0; + overflow-y: auto; + overscroll-behavior: contain; +} .doc { max-width: 820px; } .doc-head h1 { font-size: 30px; line-height: 1.35; margin: 0 0 8px; } .doc-summary { margin: 0 0 6px; color: var(--text-muted); } @@ -498,11 +518,21 @@ a:hover { text-decoration: underline; } .doc-toc .lv-3 { padding-left: 14px; } .doc-toc .lv-4 { padding-left: 28px; } +.doc-foot { + max-width: 820px; + margin: 32px 0 0; + padding-top: 16px; + border-top: 1px solid var(--border); + font-size: 12.5px; + color: #94a3b8; +} + .empty { max-width: 720px; } .empty h1 { font-size: 26px; } .empty p { color: var(--text-muted); } .footer { + flex: 0 0 auto; border-top: 1px solid var(--border); padding: 20px; text-align: center; @@ -511,11 +541,28 @@ a:hover { text-decoration: underline; } } @media (max-width: 900px) { - .layout { grid-template-columns: 1fr; } - .sidebar { border-right: 0; border-bottom: 1px solid var(--border); } + .layout { + grid-template-columns: minmax(0, 1fr); + grid-template-rows: minmax(0, auto) minmax(0, 1fr); + } + .sidebar { + max-height: 40vh; + border-right: 0; + border-bottom: 1px solid var(--border); + padding: 16px 16px 20px; + } .content { padding: 24px 20px 48px; } .doc-head h1 { font-size: 24px; } } + +/* 打印时恢复自然文档流,避免长文被固定高度裁掉 */ +@media print { + html, body { height: auto; overflow: visible; } + body { display: block; } + .topbar { position: static; } + .layout { display: block; overflow: visible; min-height: 0; } + .sidebar, .content { overflow: visible; max-height: none; height: auto; } +} `; } }