初始提交
This commit is contained in:
63
suixinkan/App/Navigation/AppTab.swift
Normal file
63
suixinkan/App/Navigation/AppTab.swift
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// 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:
|
||||
"我的"
|
||||
}
|
||||
}
|
||||
|
||||
var systemImage: String {
|
||||
switch self {
|
||||
case .home:
|
||||
"house"
|
||||
case .orders:
|
||||
"doc.text"
|
||||
case .statistics:
|
||||
"chart.bar"
|
||||
case .profile:
|
||||
"person"
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
var rootView: some View {
|
||||
switch self {
|
||||
case .home:
|
||||
HomeRootView()
|
||||
case .orders:
|
||||
OrdersRootView()
|
||||
case .statistics:
|
||||
StatisticsRootView()
|
||||
case .profile:
|
||||
ProfileRootView()
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
var label: some View {
|
||||
Label(title, systemImage: systemImage)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user