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