fix index
This commit is contained in:
parent
33eecfcfcb
commit
d785eef3df
@ -212,7 +212,6 @@ struct IndexView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 基于日期的更新列表
|
// 基于日期的更新列表
|
||||||
|
|
||||||
ScrollView(.vertical, showsIndicators: false) {
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
VStack(alignment: .center, spacing: 10) {
|
VStack(alignment: .center, spacing: 10) {
|
||||||
ForEach(indexModel.showUpdateDramas, id: \.id) { drama in
|
ForEach(indexModel.showUpdateDramas, id: \.id) { drama in
|
||||||
@ -230,6 +229,7 @@ struct IndexView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .item(let item):
|
case .item(let item):
|
||||||
|
NavigationLink(destination: DetailView(id: item.id)) {
|
||||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||||
image.resizable()
|
image.resizable()
|
||||||
} placeholder: {
|
} placeholder: {
|
||||||
@ -258,6 +258,7 @@ struct IndexView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.frame(height: 0)
|
.frame(height: 0)
|
||||||
@ -311,22 +312,6 @@ struct IndexView: View {
|
|||||||
//print(userModel)
|
//print(userModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func addItem() {
|
|
||||||
// withAnimation {
|
|
||||||
// let newItem = Item(timestamp: Date())
|
|
||||||
// modelContext.insert(newItem)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private func deleteItems(offsets: IndexSet) {
|
|
||||||
// withAnimation {
|
|
||||||
// for index in offsets {
|
|
||||||
// modelContext.delete(items[index])
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension IndexView {
|
extension IndexView {
|
||||||
@ -385,44 +370,6 @@ extension IndexView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension IndexView {
|
|
||||||
|
|
||||||
struct UpdateDramaCellView: View {
|
|
||||||
let showItem: IndexModel.UpdateDramaShowItem
|
|
||||||
@Binding var showDateNavPopover: Bool
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
switch showItem.element {
|
|
||||||
case .group(let group):
|
|
||||||
Text(group.group_name)
|
|
||||||
.onTapGesture {
|
|
||||||
showDateNavPopover = true
|
|
||||||
}
|
|
||||||
case .item(let item):
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
|
||||||
image.resizable()
|
|
||||||
} placeholder: {
|
|
||||||
ProgressView()
|
|
||||||
}
|
|
||||||
.frame(width: 80, height: 80)
|
|
||||||
.overlay {
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text(item.name)
|
|
||||||
.lineLimit(1)
|
|
||||||
|
|
||||||
Text(item.status)
|
|
||||||
.lineLimit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(width: 100, height: 120)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
IndexView()
|
IndexView()
|
||||||
.modelContainer(for: Item.self, inMemory: true)
|
.modelContainer(for: Item.self, inMemory: true)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user