Skip to content

Commit ce483be

Browse files
committed
Add comment list index
1 parent d927c99 commit ce483be

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

V2exOS/Views/TopicDetail/CommentListView.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ struct CommentListView: View {
2121
Label("\(commentCount ?? 0) 条回复", systemImage: "bubble.middle.bottom.fill")
2222

2323
if let commentList {
24-
ForEach(commentList) { comment in
24+
ForEach(0..<commentList.count, id: \.self) { index in
25+
let comment = commentList[index]
2526

2627
Divider()
2728

@@ -44,6 +45,10 @@ struct CommentListView: View {
4445
if let created = comment.created {
4546
Text(Date(timeIntervalSince1970: TimeInterval(created)).fromNow())
4647
}
48+
49+
Spacer()
50+
51+
Text("#\(index)")
4752
}
4853
.foregroundColor(Color(NSColor.tertiaryLabelColor))
4954

@@ -65,7 +70,7 @@ struct CommentListView: View {
6570
.font(.body)
6671
}
6772
}
68-
}
73+
}
6974
}
7075
}
7176
}

0 commit comments

Comments
 (0)