MainPagingView.swift
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// MainPagingView.swift
// hippo-watch Watch App
//
// Created by shihao on 2025/6/6.
//
import SwiftUI
struct MainPagingView: View {
@State private var showPKView = false
@State private var currentPage = 0
@EnvironmentObject var router: WatchNotificationRouter
var body: some View {
NavigationView {
ZStack {
// 主要内容 - 垂直分页
TabView(selection: $currentPage) {
StatusComparisonView(showPKView: $showPKView)
.tag(0)
TodayDataView()
.tag(1)
TakePulseView()
.tag(2)
}
#if os(watchOS)
.tabViewStyle(.verticalPage)
#else
.tabViewStyle(.page)
#endif
}
.navigationBarHidden(true)
}
.fullScreenCover(isPresented: $showPKView, content: {
PKDetailView()
})
.onAppear {
router.consumeCachedPayloadIfNeeded()
}
.onChange(of: router.pendingNotification?.id) { _, id in
guard let id else { return }
// TODO: 根据 id 跳转详情页
print("跳转通知详情:", id)
}
}
}