修复 Tab 导航栈路径绑定,确保子页面 push 后立即响应。

直接观察 RouterPath 并绑定 NavigationStack,移除未使用的 AppTab/AppRouter 辅助 API。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 11:45:34 +08:00
parent 8e34a45d50
commit d310d26293
5 changed files with 24 additions and 32 deletions

View File

@ -28,8 +28,8 @@ Main 模块负责登录后的主界面 Tab 容器,以及当前尚未迁移页
2. `TabView` 使用内部 `MainTabSelection` 作为选择值,普通 Tab 映射到 `AppTab`,扫码映射到 `.scanner`
3. 普通 Tab 切换时调用 `AppRouter.select(_:)` 更新当前业务 Tab。
4. 每个普通 Tab 通过 `TabNavigationStackHost` 创建自己的 `NavigationStack(path:)`
5. 路径绑定来自 `appRouter.binding(for:)`
6. Tab 内页面需要进入尚未迁移的子页面时,通过当前 Tab 注入的 `RouterPath` push 一个 `AppRoute.placeholder`
5. 导航栈宿主直接观察当前 Tab 对应的 `RouterPath`,并把 `$router.path` 绑定给 `NavigationStack`
6. Tab 内页面需要进入子页面时,通过当前 Tab 注入的 `RouterPath` push 对应 `AppRoute`
7. `navigationDestination` 根据 `AppRoute` 展示详情页。
8. 子页面展示时读取 `AppRoute.hidesTabBarWhenPushed`,默认隐藏底部 TabBar。