fix
This commit is contained in:
parent
c5508bdf7c
commit
158b8db646
@ -82,19 +82,34 @@ struct IndexView: View {
|
||||
}
|
||||
.background(GeometryReader { geometry in
|
||||
Color.clear.onChange(of: geometry.frame(in: .global).minY) {_, offset in
|
||||
let contentHeight = geometry.size.height
|
||||
let scrollViewHeight = UIScreen.main.bounds.height
|
||||
|
||||
// 判断是否滑动到底部
|
||||
if offset + contentHeight > scrollViewHeight - 50 {
|
||||
}
|
||||
})
|
||||
|
||||
Rectangle()
|
||||
.frame(height: 0)
|
||||
.background(GeometryReader {
|
||||
geometry in
|
||||
Color.clear.onChange(of: geometry.frame(in: .global).minY) {_, offset in
|
||||
let frame = geometry.frame(in: .global)
|
||||
let screenBounds = UIScreen.main.bounds
|
||||
/*
|
||||
if frame.intersects(screenBounds) {
|
||||
print("call me here11")
|
||||
}
|
||||
*/
|
||||
if screenBounds.height - frame.minY > 50 {
|
||||
print("call me here")
|
||||
Task {
|
||||
await self.loadMoreUpdateDramas()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if self.isLoading {
|
||||
ProgressView()
|
||||
}
|
||||
}
|
||||
}
|
||||
.task {
|
||||
@ -108,12 +123,11 @@ struct IndexView: View {
|
||||
self.dramas = result.dramas
|
||||
self.showUpdateDramas = Self.yes(updateDramas: result.updateDramas)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private func loadMoreUpdateDramas() async {
|
||||
guard !self.isLoading else {
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user