From 78a8d188d18b4ce380708ef08bbdc3fff1aba90d Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 16 Jul 2026 14:36:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E9=87=8D=E5=BB=BA=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=B6=88=E6=81=AF=E6=94=B9=E7=BB=9D=E5=AF=B9=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D,=E9=81=BF=E5=85=8D=E6=92=91=E9=AB=98=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E9=A1=B6=E8=B5=B7=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RebuildCacheBar 原用 flex-col 把「已重建 x 篇文章」消息排在按钮下方, 参与文档流。其祖先 header 为 md:items-end(底边固定),消息出现时 新增高度全部转化为按钮上移,「重建内容/重建全部」被顶起、「发布文章」 相对下沉,三者错位。 改为外层 relative + 消息 absolute top-full 脱离文档流:出现/消失都 不影响按钮行高度,布局稳定。双 target 编译通过。 --- src/pages/admin/posts.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/admin/posts.rs b/src/pages/admin/posts.rs index 166f3a5..9ab7add 100644 --- a/src/pages/admin/posts.rs +++ b/src/pages/admin/posts.rs @@ -295,9 +295,10 @@ fn RebuildCacheBar() -> Element { }; rsx! { - // 竖向布局:按钮行 + 结果消息行(右对齐,消息行不撑高按钮行)。 + // 消息绝对定位到按钮行下方,脱离文档流:出现/消失都不撑高祖先容器, + // 避免 header 的 md:items-end 把固定底边转化为按钮上移("按钮被顶上去" bug)。 // 自持 rebuilding / rebuild_result state,与父组件零耦合。 - div { class: "flex flex-col items-end gap-1", + div { class: "relative flex items-center gap-3", div { class: "flex items-center gap-3", Tooltip { tip: "重建 content_html 为空的文章渲染缓存".to_string(), @@ -332,9 +333,9 @@ fn RebuildCacheBar() -> Element { } } } - // 重建结果消息:独立成行,右对齐,与按钮行同属本组件。 + // 重建结果消息:绝对定位到按钮行正下方,脱离文档流,不影响布局高度。 if let Some(msg) = rebuild_result() { - div { class: "text-xs text-paper-secondary whitespace-pre-line", "{msg}" } + div { class: "absolute top-full right-0 mt-1 text-xs text-paper-secondary whitespace-pre-line", "{msg}" } } } }