fix date view
This commit is contained in:
parent
7a1d545506
commit
3d6709c2c7
@ -51,6 +51,9 @@ struct IndexView: View {
|
||||
@State var dramas: [DramaItem] = []
|
||||
@State var showUpdateDramas: [UpdateDramaShowItem] = []
|
||||
@State var isLoading: Bool = false
|
||||
|
||||
// 是否显示日期弹出层
|
||||
@State private var showDateNavPopover: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center) {
|
||||
@ -78,7 +81,7 @@ struct IndexView: View {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack {
|
||||
ForEach(showUpdateDramas.indices, id: \.self) { index in
|
||||
UpdateDramaCellView(showItem: showUpdateDramas[index])
|
||||
UpdateDramaCellView(showItem: showUpdateDramas[index], showDateNavPopover: $showDateNavPopover)
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +106,9 @@ struct IndexView: View {
|
||||
ProgressView()
|
||||
}
|
||||
}
|
||||
|
||||
.popover(isPresented: $showDateNavPopover) {
|
||||
DateNavView()
|
||||
}
|
||||
}
|
||||
.task {
|
||||
let response = await API.getIndexData(as: IndexResponse.self)
|
||||
@ -207,12 +212,15 @@ extension IndexView {
|
||||
|
||||
struct UpdateDramaCellView: View {
|
||||
let showItem: UpdateDramaShowItem
|
||||
@Binding var showDateNavPopover: Bool
|
||||
|
||||
var body: some View {
|
||||
|
||||
switch showItem {
|
||||
case .lable(let name):
|
||||
Text(name)
|
||||
.onTapGesture {
|
||||
showDateNavPopover = true
|
||||
}
|
||||
case .item(let item):
|
||||
VStack(alignment: .center) {
|
||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user