Fix: 调整Strapi类型

This commit is contained in:
2025-08-18 12:04:32 +08:00
parent 631146eeb8
commit 5f0d13c122
3 changed files with 16 additions and 11 deletions

View File

@ -97,7 +97,6 @@ onMounted(async () => {
populate: '*', populate: '*',
locale: strapiLocale, locale: strapiLocale,
}) })
if (response.data) { if (response.data) {
const item = response.data const item = response.data
production.value = { production.value = {
@ -108,7 +107,7 @@ onMounted(async () => {
production_specs: item.production_specs, production_specs: item.production_specs,
production_image: item.production_image, production_image: item.production_image,
documentId: item.documentId, documentId: item.documentId,
} documents: item.documents || [] }
} }
} catch (error) { } catch (error) {
console.error('Failed to fetch production:', error) console.error('Failed to fetch production:', error)

View File

@ -7,18 +7,13 @@ export interface StrapiEntity {
locale?: string; locale?: string;
} }
export interface StrapiImage { export interface StrapiMedia {
id: number; id: number;
url: string; url: string;
ext?: string;
name?: string;
alternativeText?: string; alternativeText?: string;
caption?: string; caption?: string;
width?: number;
height?: number;
formats?: {
small?: StrapiImageFormat;
medium?: StrapiImageFormat;
thumbnail?: StrapiImageFormat;
}
} }
export interface StrapiImageFormat { export interface StrapiImageFormat {
@ -28,6 +23,16 @@ export interface StrapiImageFormat {
size: number; size: number;
} }
export interface StrapiImage extends StrapiMedia {
width?: number;
height?: number;
formats?: {
small?: StrapiImageFormat;
medium?: StrapiImageFormat;
thumbnail?: StrapiImageFormat;
}
}
export interface StrapiResponse<T> { export interface StrapiResponse<T> {
data: T; data: T;
meta?: { meta?: {

View File

@ -1,4 +1,4 @@
import type { StrapiEntity, StrapiImage } from './common'; import type { StrapiEntity, StrapiImage, StrapiMedia } from './common';
export interface ProductionType extends StrapiEntity { export interface ProductionType extends StrapiEntity {
type: string; type: string;
@ -11,4 +11,5 @@ export interface Production extends StrapiEntity {
production_image?: StrapiImage; production_image?: StrapiImage;
production_details?: string; production_details?: string;
production_specs?: string | object; production_specs?: string | object;
documents?: StrapiMedia[];
} }