fix view
This commit is contained in:
parent
acb51093c4
commit
cfe9dd5c2e
@ -84,18 +84,19 @@ struct IndexMainView: View {
|
||||
.frame(width: 370)
|
||||
.coordinateSpace(name: "indexScrollView")
|
||||
.onScrollPhaseChange { oldPhase, newPhase in
|
||||
print("scroll old: \(oldPhase), new: \(newPhase), footer-offset: \(footerOffset)")
|
||||
guard !footerRefreshing && !showDateNavPopover else {
|
||||
return
|
||||
}
|
||||
|
||||
print("scroll old: \(oldPhase), new: \(newPhase), footer-offset: \(footerOffset)")
|
||||
// 滑动停止的时候,检测是否到达了底部
|
||||
let height = Int(UIScreen.main.bounds.height)
|
||||
if newPhase == .idle && self.footerOffset < height + 500 {
|
||||
let distance = height - footerOffset
|
||||
if newPhase == .idle && (distance >= 0 && distance < 50) {
|
||||
self.footerRefreshing = true
|
||||
Task {
|
||||
await self.indexModel.loadMoreUpdateDramas(userId: self.userId, mode: .next)
|
||||
await MainActor.run {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||
self.footerRefreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user