Files
汉秋 d310d26293 修复 Tab 导航栈路径绑定,确保子页面 push 后立即响应。
直接观察 RouterPath 并绑定 NavigationStack,移除未使用的 AppTab/AppRouter 辅助 API。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 11:45:34 +08:00

74 lines
1.6 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppTab.swift
// suixinkan
//
// Created by Codex on 2026/6/18.
//
import SwiftUI
/// Tab
enum AppTab: String, CaseIterable, Identifiable, Hashable {
case home
case orders
case statistics
case profile
var id: Self { self }
var title: String {
switch self {
case .home:
"首页"
case .orders:
"订单"
case .statistics:
"数据"
case .profile:
"我的"
}
}
/// Tab 使
var selectedImageName: String {
switch self {
case .home:
"tab_home_selected"
case .orders:
"tab_order_selected"
case .statistics:
"tab_data_selected"
case .profile:
"tab_profile_selected"
}
}
/// Tab 使
var unselectedImageName: String {
switch self {
case .home:
"tab_home_unselected"
case .orders:
"tab_order_unselected"
case .statistics:
"tab_data_unselected"
case .profile:
"tab_profile_unselected"
}
}
@ViewBuilder
var rootView: some View {
switch self {
case .home:
HomeRootView()
case .orders:
OrdersRootView()
case .statistics:
StatisticsRootView()
case .profile:
ProfileRootView()
}
}
}