This commit is contained in:
anlicheng 2025-06-10 17:55:05 +08:00
parent eecee74af2
commit 46bf943d4c
2 changed files with 18 additions and 4 deletions

View File

@ -62,7 +62,7 @@ struct IndexMainView: View {
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
Rectangle() Rectangle()
.frame(width: 0, height: 10) .frame(width: 0, height: 38)
// //
LazyVStack(alignment: .center, spacing: 10) { LazyVStack(alignment: .center, spacing: 10) {
@ -130,6 +130,14 @@ struct IndexMainView: View {
} }
.padding([.top, .bottom], 8) .padding([.top, .bottom], 8)
.background(.white) .background(.white)
.background(
GeometryReader { geometry in
Color.clear
.onAppear {
print("hstack height is: \(geometry.size.height)")
}
}
)
} }
} }
.ignoresSafeArea(edges: .bottom) .ignoresSafeArea(edges: .bottom)

View File

@ -62,6 +62,7 @@ final class IndexModel {
// //
var updateDramaGroups: [UpdateDramaGroup] = [] var updateDramaGroups: [UpdateDramaGroup] = []
// , 便
var dramaGroupElements: [GroupElement] = [] var dramaGroupElements: [GroupElement] = []
var follow_num: String = "0" var follow_num: String = "0"
@ -100,17 +101,16 @@ final class IndexModel {
switch self.dramaGroupElements[scrollID] { switch self.dramaGroupElements[scrollID] {
case .label(_, _): case .label(_, _):
() ()
case .item(let groupId, let item): case .item(let groupId, _):
DispatchQueue.main.async { DispatchQueue.main.async {
self.setFixedDrameGroup(groupId: groupId) self.setFixedDrameGroup(groupId: groupId)
} }
} }
// //
let ids = self.getDramaIds(self.updateDramaGroups).suffix(6)
let timeDistance = self.updateInterval.distance(to: Date()) let timeDistance = self.updateInterval.distance(to: Date())
// //
if timeDistance > 1.0 && ids.contains(scrollID) { if timeDistance > 1.0 && self.dramaGroupElements.count - scrollID < 6 {
Task { Task {
await self.loadMoreUpdateDramasTask(userId: userId, mode: .next) await self.loadMoreUpdateDramasTask(userId: userId, mode: .next)
} }
@ -223,6 +223,12 @@ final class IndexModel {
groupElements.append(.item(group.group_id, item)) groupElements.append(.item(group.group_id, item))
} }
} }
//
if groupElements.count > 0 {
groupElements.removeFirst()
}
return groupElements return groupElements
} }