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: '*',
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)

View File

@ -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<T> {
data: T;
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 {
type: string;
@ -11,4 +11,5 @@ export interface Production extends StrapiEntity {
production_image?: StrapiImage;
production_details?: string;
production_specs?: string | object;
documents?: StrapiMedia[];
}