Feature: 页面内Markdown渲染 & 规格参数表格

This commit is contained in:
2025-08-16 13:57:17 +08:00
parent c77b2282da
commit daa91ac56f
10 changed files with 221 additions and 36 deletions

View File

@ -15,10 +15,23 @@
<script setup lang="ts">
import type { StrapiLocale } from '@nuxtjs/strapi'
const { find } = useStrapi()
const { locale: i18nLocale } = useI18n()
const baseUrl = 'http://192.168.86.5:1337';
interface Production {
id: number;
title: string;
summary: string;
production_image?: {
url: string;
};
documentId?: string;
}
class ProductionInfo {
id: number;
title: string;
@ -35,17 +48,21 @@ class ProductionInfo {
}
}
const strapiLocales = {
'zh': 'zh-Hans' as StrapiLocale, // 简体中文
'en': 'en' as StrapiLocale // 英文
};
const productions = ref<ProductionInfo[]>();
onMounted(async () => {
try {
const response = await find('productions', {
const response = await find<Production>('productions', {
populate: '*',
}) as any
locale: strapiLocales[i18nLocale.value], // 使用简体中文
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
productions.value = response.data.map((item: any) => {
productions.value = response.data.map((item: Production) => {
return new ProductionInfo(
item.id,
item.title,
@ -66,7 +83,7 @@ onMounted(async () => {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
padding: 20px;
gap: 20px;
}
</style>