Skip to content

Commit 30dd4eb

Browse files
committed
optimization topic list loadmore
1 parent 4fcd202 commit 30dd4eb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

V2exOS/Views/TopicList/TopicListView.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,20 @@ struct TopicListView: View {
3131
if topics.count > 0 && nodeName != NodeNameAll && nodeName != NodeNameHot {
3232
HStack {
3333
Spacer()
34-
ProgressView()
35-
.onAppear {
36-
Task {
37-
await self.loadData(page: self.page + 1)
34+
// 已登陆或列表为空时才加载数据(非登陆用户 API 限制只能取第一页)
35+
if currentUser.user != nil || topics.isEmpty {
36+
ProgressView()
37+
.onAppear {
38+
Task {
39+
await self.loadData(page: self.page + 1)
40+
}
3841
}
39-
}
42+
}else {
43+
Text("登录后可查看更多内容")
44+
.font(.footnote)
45+
.foregroundColor(.secondary)
46+
.padding(20)
47+
}
4048
Spacer()
4149
}
4250
}

0 commit comments

Comments
 (0)