From 5f0d13c1221c642d4d315b34072db651d907485f Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Mon, 18 Aug 2025 12:04:32 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E8=B0=83=E6=95=B4Strapi=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/productions/[...slug].vue | 3 +-- app/types/strapi/common.ts | 21 +++++++++++++-------- app/types/strapi/production.ts | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/pages/productions/[...slug].vue b/app/pages/productions/[...slug].vue index 64c337c..557d450 100644 --- a/app/pages/productions/[...slug].vue +++ b/app/pages/productions/[...slug].vue @@ -97,7 +97,6 @@ onMounted(async () => { populate: '*', locale: strapiLocale, }) - if (response.data) { const item = response.data production.value = { @@ -108,7 +107,7 @@ onMounted(async () => { production_specs: item.production_specs, production_image: item.production_image, documentId: item.documentId, - } + documents: item.documents || [] } } } catch (error) { console.error('Failed to fetch production:', error) diff --git a/app/types/strapi/common.ts b/app/types/strapi/common.ts index ef5fb21..a6c1c52 100644 --- a/app/types/strapi/common.ts +++ b/app/types/strapi/common.ts @@ -7,18 +7,13 @@ export interface StrapiEntity { locale?: string; } -export interface StrapiImage { +export interface StrapiMedia { id: number; url: string; + ext?: string; + name?: string; alternativeText?: string; caption?: string; - width?: number; - height?: number; - formats?: { - small?: StrapiImageFormat; - medium?: StrapiImageFormat; - thumbnail?: StrapiImageFormat; - } } export interface StrapiImageFormat { @@ -28,6 +23,16 @@ export interface StrapiImageFormat { size: number; } +export interface StrapiImage extends StrapiMedia { + width?: number; + height?: number; + formats?: { + small?: StrapiImageFormat; + medium?: StrapiImageFormat; + thumbnail?: StrapiImageFormat; + } +} + export interface StrapiResponse { data: T; meta?: { diff --git a/app/types/strapi/production.ts b/app/types/strapi/production.ts index ac84b18..b5dcc0e 100644 --- a/app/types/strapi/production.ts +++ b/app/types/strapi/production.ts @@ -1,4 +1,4 @@ -import type { StrapiEntity, StrapiImage } from './common'; +import type { StrapiEntity, StrapiImage, StrapiMedia } from './common'; export interface ProductionType extends StrapiEntity { type: string; @@ -11,4 +11,5 @@ export interface Production extends StrapiEntity { production_image?: StrapiImage; production_details?: string; production_specs?: string | object; + documents?: StrapiMedia[]; } \ No newline at end of file