From e5dee4daf1dff573da1a2964cc366e1aed5cb8d0 Mon Sep 17 00:00:00 2001 From: Sakurasan <26715255+Sakurasan@users.noreply.github.com> Date: Thu, 1 Oct 2026 17:32:54 +0800 Subject: [PATCH] =?UTF-8?q?vivid=20=E6=89=8B=E6=9C=BA=E7=AB=AF=E9=A1=B6?= =?UTF-8?q?=E6=A0=8F=E4=B8=8B=E6=BB=91=E8=87=AA=E5=8A=A8=E9=9A=90=E8=97=8F?= =?UTF-8?q?=EF=BC=9A=E6=BB=9A=E8=BF=87=2080px=20=E5=90=91=E4=B8=8B?= =?UTF-8?q?=E6=BB=91=E6=94=B6=E8=B5=B7=E3=80=81=E5=90=91=E4=B8=8A=E6=BB=91?= =?UTF-8?q?=E6=88=96=E5=9B=9E=E9=A1=B5=E9=A6=96=E5=8D=B3=E5=9B=9E=E7=8E=B0?= =?UTF-8?q?=EF=BC=8C2px=20=E6=8A=96=E5=8A=A8=E8=BF=87=E6=BB=A4=EF=BC=8C?= =?UTF-8?q?=E6=8A=BD=E5=B1=89=E6=89=93=E5=BC=80=E6=9C=9F=E9=97=B4=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E5=8F=AF=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/ui/yohaku/YohakuTop.vue | 21 ++++++++++++++++++--- frontend/src/ui/yohaku/chrome.css | 6 +++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/frontend/src/ui/yohaku/YohakuTop.vue b/frontend/src/ui/yohaku/YohakuTop.vue index 2698e71..eec88dd 100644 --- a/frontend/src/ui/yohaku/YohakuTop.vue +++ b/frontend/src/ui/yohaku/YohakuTop.vue @@ -26,6 +26,10 @@ const scrolled = ref(false) const menuOpen = ref(false) const burger = ref(null) const drawerEl = ref(null) +// 手机端顶栏:向下滑动藏起来给内容让路,向上一滑就回来。 +// 抽屉开着时不藏——汉堡就是 ✕,藏了就没法关菜单。 +const barHidden = ref(false) +let lastY = 0 const links = [ { to: '/', label: '时间线', icon: PhHouse }, @@ -42,7 +46,17 @@ function isOn(l) { } function onScroll() { - scrolled.value = (window.scrollY || 0) > 8 + const y = window.scrollY || 0 + scrolled.value = y > 8 + // 页首附近不藏(没什么可让的路),滚过一屏的 1/8 才启用; + // 方向反转立即回来,误差抖动(|Δ|<2px)不触发 + if (menuOpen.value) { + barHidden.value = false + } else if (Math.abs(y - lastY) >= 2) { + if (y > lastY && y > 80) barHidden.value = true + else barHidden.value = false + } + lastY = y } function toggleMenu() { @@ -119,8 +133,9 @@ function toggleTheme() { -
+ 必须待在 .top 外面:.top 有 backdrop-filter,会给 fixed 后代当包含块。 + 向下滑动自动藏起(.bar-hide),给内容让路;向上一滑立刻回来。 --> +
{{ title() }} diff --git a/frontend/src/ui/yohaku/chrome.css b/frontend/src/ui/yohaku/chrome.css index c9ecd9f..eb85bfe 100644 --- a/frontend/src/ui/yohaku/chrome.css +++ b/frontend/src/ui/yohaku/chrome.css @@ -61,7 +61,11 @@ html[data-ui='vivid'] .top-m {position:fixed;z-index:120; border-bottom:1px solid var(--line); background:color-mix(in srgb,var(--card) 82%,transparent); backdrop-filter:blur(20px) saturate(1.5); - -webkit-backdrop-filter:blur(20px) saturate(1.5);} + -webkit-backdrop-filter:blur(20px) saturate(1.5); + transition:transform .28s var(--ease);} +/* 向下滑动自动藏起:transform 滑出屏幕,不占布局本来也不占,纯粹让开视线。 + 抽屉开着时 JS 保证不加这个类(汉堡是 ✕,不能消失) */ +html[data-ui='vivid'] .top-m.bar-hide {transform:translateY(-105%)} html[data-ui='vivid'] .top-m-brand {display:flex;align-items:center;gap:10px; font-weight:700;font-size:14px;letter-spacing:.02em;color:var(--ink);} html[data-ui='vivid'] .top-m-brand .av {width:28px;height:28px;flex:none;color:var(--ink);}