From 51e06cf118755609d75671488fe8fd7f09d9b08f Mon Sep 17 00:00:00 2001 From: xfy Date: Wed, 15 Jul 2026 10:00:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20Pagination=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8F=AF=E9=80=89=20on=5Fprev/on=5Fnext=20=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E7=BF=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻页要本地化(走客户端 signal 而非路由)时,传入 on_prev/on_next 即渲染 button onclick;不传则保持原路由式 Link,前台/其他分页页面零影响。 为合并 /admin/posts 与 /admin/posts/trash 为单路由 tab 做准备:两个 tab 的列表翻页将改为 signal 驱动。prev_route/next_route 改为带默认值 (Route::Home {} 占位),回调存在时不被读取。 --- src/components/ui.rs | 45 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/components/ui.rs b/src/components/ui.rs index 425a393..cc23c82 100644 --- a/src/components/ui.rs +++ b/src/components/ui.rs @@ -115,18 +115,24 @@ pub const BTN_ICON: &str = /// - `current_page`:当前页码(从 1 开始) /// - `total`:数据总条数 /// - `per_page`:每页条数,用于计算总页数 -/// - `prev_route`:点击上一页跳转的目标路由 -/// - `next_route`:点击下一页跳转的目标路由 +/// - `prev_route`:点击上一页跳转的目标路由(路由式翻页用) +/// - `next_route`:点击下一页跳转的目标路由(路由式翻页用) /// - `unit`:计数单位("篇" / "条"),仅 admin 显示计数时使用 +/// - `on_prev` / `on_next`:可选回调。传入时渲染 `