feat: 实现MomentListItem点赞功能及状态管理
- 在MomentListItem中新增点赞功能,用户点击按钮可触发点赞请求。 - 使用MVVM+Combine架构管理点赞状态,确保UI与状态同步。 - 添加加载状态和错误处理,提升用户体验和交互反馈。 - 更新相关视图以支持新的点赞逻辑,优化代码可读性和维护性。
This commit is contained in:
@@ -40,7 +40,8 @@ struct MomentListHomePage: View {
|
||||
.padding(.top, 16)
|
||||
|
||||
// 标语
|
||||
Text(LocalizedString("feedList.slogan", comment: "The disease is like a cruel ruler,\nand time is our most precious treasure.\nEvery moment we live is a victory\nagainst the inevitable."))
|
||||
Text(LocalizedString("feedList.slogan",
|
||||
comment: ""))
|
||||
.font(.system(size: 16))
|
||||
.multilineTextAlignment(.leading)
|
||||
.foregroundColor(.white.opacity(0.9))
|
||||
@@ -64,7 +65,8 @@ struct MomentListHomePage: View {
|
||||
debugInfoSync(" 图片数量: \(images.count)")
|
||||
}
|
||||
)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.leading, 16)
|
||||
.padding(.trailing, 32)
|
||||
.onAppear {
|
||||
// 当显示倒数第三个项目时,开始加载更多
|
||||
if index == viewModel.moments.count - 3 {
|
||||
@@ -94,7 +96,7 @@ struct MomentListHomePage: View {
|
||||
.padding(.vertical, 20)
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 100) // 为底部导航栏留出空间
|
||||
.padding(.bottom, 160) // 为底部导航栏留出空间
|
||||
}
|
||||
.refreshable {
|
||||
// 下拉刷新
|
||||
|
Reference in New Issue
Block a user