diff --git a/frontend/src/components/AppLayout.vue b/frontend/src/components/AppLayout.vue index 137342c..f8a38a5 100644 --- a/frontend/src/components/AppLayout.vue +++ b/frontend/src/components/AppLayout.vue @@ -1,13 +1,12 @@ + + diff --git a/frontend/src/style.css b/frontend/src/style.css index e90dba6..3763d7f 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -68,6 +68,88 @@ h1 { font-size: 28px; font-weight: 700; line-height: 1.3; } h2 { font-size: 22px; font-weight: 700; line-height: 1.35; } h3 { font-size: 18px; font-weight: 700; line-height: 1.4; } +/* ============================================================ + * 手机端适配 + * + * 触发断点: + * - 768px:pad / 小屏(侧栏改成抽屉) + * - 480px:手机竖屏(进一步压缩 padding / 字号) + * + * 改动: + * 1) 容器 padding 缩小,正文最大宽度限制放宽 + * 2) 卡片内边距 / 标题字号 / 评论钩子字号按档位缩 + * 3) 文章正文段间距、行高按手机阅读体验调 + * 4) 标签 / Tag 不再强制 nowrap(允许换行,避免溢出) + * 5) 顶栏 NSpace 在小屏允许换行,过滤区也允许 wrap + * ============================================================ */ +@media (max-width: 768px) { + :root { + --max-width: 100%; + } + + /* 顶栏/正文容器 padding 收紧 */ + .n-layout-header, + .n-layout-header.n-layout-header--absolute-positioned { + padding: 10px 14px !important; + } + .n-layout-content { + padding: 14px !important; + } + + /* 卡片 padding 缩 25% */ + .n-card.article-card .n-card__content { + padding: 12px 14px !important; + } + + /* 标题字号档位降 1 档 */ + h1 { font-size: 22px; line-height: 1.35; } + h2 { font-size: 20px; line-height: 1.4; } + h3 { font-size: 17px; line-height: 1.45; } + + /* 文章正文:行高微调(屏幕窄,行高再松一点) */ + .article-body { font-size: 16px; line-height: 1.8; } + .diary-para { font-size: 16px; line-height: 1.8; } + + /* 评论钩子字号微调 */ + .commentary-box { font-size: 13px; padding: 10px 12px; } + .commentary-text { font-size: 13px; } + + /* 详情页字段 */ + .commentary-text-detail { font-size: 14.5px; line-height: 1.8; } + .article-body-fallback { font-size: 15px; line-height: 1.8; } + + /* 顶栏字号 / 配额 tag */ + .n-layout-header span[style*="font-size: 20px"] { + font-size: 17px !important; + } + + /* 滚动条:手机端太窄,隐藏 */ + ::-webkit-scrollbar { width: 0; height: 0; } +} + +@media (max-width: 480px) { + .n-card.article-card .n-card__content { + padding: 10px 12px !important; + } + h1 { font-size: 20px; } + .article-body { font-size: 15.5px; } + .diary-para { font-size: 15.5px; } +} + +/* 工具类:手机端隐藏侧栏相关装饰 */ +@media (max-width: 768px) { + .mobile-hide { + display: none !important; + } + .mobile-stack { + flex-direction: column !important; + align-items: stretch !important; + } + .mobile-full-width { + width: 100% !important; + } +} + /* ===== 文章卡片 ===== */ .n-card.article-card { margin-bottom: 16px; diff --git a/frontend/src/views/ArticleDetail.vue b/frontend/src/views/ArticleDetail.vue index e91937d..9336800 100644 --- a/frontend/src/views/ArticleDetail.vue +++ b/frontend/src/views/ArticleDetail.vue @@ -114,7 +114,7 @@ onMounted(load) - + {{ article.source.name }} {{ article.lang_src.toUpperCase() }} @@ -126,7 +126,7 @@ onMounted(load) {{ c }} - + {{ fmtTime(publishedAt) }} @@ -148,7 +148,7 @@ onMounted(load) - + \ No newline at end of file diff --git a/frontend/src/views/Feed.vue b/frontend/src/views/Feed.vue index dd9cb35..5dc8f05 100644 --- a/frontend/src/views/Feed.vue +++ b/frontend/src/views/Feed.vue @@ -116,22 +116,22 @@ onMounted(async () => {