fix
This commit is contained in:
parent
42eca56b59
commit
c5508bdf7c
@ -88,6 +88,9 @@ struct IndexView: View {
|
||||
// 判断是否滑动到底部
|
||||
if offset + contentHeight > scrollViewHeight - 50 {
|
||||
print("call me here11")
|
||||
Task {
|
||||
await self.loadMoreUpdateDramas()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,21 +108,26 @@ struct IndexView: View {
|
||||
self.dramas = result.dramas
|
||||
self.showUpdateDramas = Self.yes(updateDramas: result.updateDramas)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private func loadMoreUpdateDramas() async {
|
||||
// guard !self.isLoading else {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// self.isLoading = true
|
||||
//
|
||||
// if let data = await API.loadMoreUpdateDramas() {
|
||||
// try! JSONDecoder().decode([UpdateDramaItem].self, from: data)
|
||||
// }
|
||||
guard !self.isLoading else {
|
||||
return
|
||||
}
|
||||
|
||||
self.isLoading = true
|
||||
|
||||
let response = await API.loadMoreUpdateDramas(as: [UpdateDramaItem].self)
|
||||
if case let .result(items) = response {
|
||||
let showItems = Self.yes(updateDramas: items)
|
||||
self.showUpdateDramas.append(contentsOf: showItems)
|
||||
}
|
||||
|
||||
self.isLoading = false
|
||||
}
|
||||
|
||||
private func addItem() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user