From bee046dcf22df4c8256558014a85f2c28c16a294 Mon Sep 17 00:00:00 2001 From: shenmo Date: Tue, 10 Mar 2026 18:46:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E4=B8=8D?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 74dc0a40..d6bdb5b4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -318,17 +318,47 @@ const selectCategory = (category: string) => { } }; -const openDetail = (app: App) => { - currentApp.value = app; +const openDetail = (app: App | Record) => { + // 提取 pkgname(必须存在) + const pkgname = (app as any).pkgname; + if (!pkgname) { + console.warn('openDetail: 缺少 pkgname', app); + return; + } + + // 尝试从全局 apps 中查找完整 App + let fullApp = apps.value.find(a => a.pkgname === pkgname); + if (!fullApp) { + // 构造一个最小可用的 App 对象 + fullApp = { + name: (app as any).name || '', + pkgname: pkgname, + version: (app as any).version || '', + filename: (app as any).filename || '', + category: (app as any).category || 'unknown', + torrent_address: '', + author: '', + contributor: '', + website: '', + update: '', + size: '', + more: (app as any).more || '', + tags: '', + img_urls: [], + icons: '', + currentStatus: 'not-installed', + }; + } + + // 后续逻辑使用 fullApp + currentApp.value = fullApp; currentScreenIndex.value = 0; - loadScreenshots(app); + loadScreenshots(fullApp); showModal.value = true; - // 检测本地是否已经安装了该应用 currentAppIsInstalled.value = false; - checkAppInstalled(app); + checkAppInstalled(fullApp); - // 确保模态框显示后滚动到顶部 nextTick(() => { const modal = document.querySelector( '[data-app-modal="detail"] .modal-panel',