From 5ff82b10bbfc2a652b7b8db906a7350f70f9f6b9 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Mon, 24 Feb 2025 15:38:21 +0800 Subject: [PATCH] fix index view --- dimensionhub/Views/IndexView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dimensionhub/Views/IndexView.swift b/dimensionhub/Views/IndexView.swift index 97ed3eb..f7f7ab6 100644 --- a/dimensionhub/Views/IndexView.swift +++ b/dimensionhub/Views/IndexView.swift @@ -13,11 +13,16 @@ import Observation final class IndexModel { struct DramaItem: Codable { - struct Episode: Codable { - let id: Int32 + struct Episode: Codable, Identifiable { + let id = UUID().uuidString let name: String let thumb: String let num_name: String + let play: String + + enum CodingKeys: String, CodingKey { + case name, thumb, num_name, play + } } let id: Int32 @@ -260,7 +265,7 @@ extension IndexView { ScrollView(.horizontal, showsIndicators: false) { HStack(alignment: .center, spacing: 5) { - ForEach(dramaItem.episodes, id: \.id) { item in + ForEach(dramaItem.episodes) { item in VStack(alignment: .center) { GeometryReader { geometry in AsyncImage(url: URL(string: item.thumb)) { image in