Fix: 修正国际化的显示、跳转问题

This commit is contained in:
2025-08-16 15:40:08 +08:00
parent daa91ac56f
commit eaf7d3be38
8 changed files with 94 additions and 37 deletions

View File

@ -15,10 +15,10 @@
<script setup lang="ts">
import type { StrapiLocale } from '@nuxtjs/strapi'
const { find } = useStrapi()
const { locale: i18nLocale } = useI18n()
const { getStrapiLocale } = useLocalizations()
const strapiLocale = getStrapiLocale()
const baseUrl = 'http://192.168.86.5:1337';
@ -48,18 +48,13 @@ class ProductionInfo {
}
}
const strapiLocales = {
'zh': 'zh-Hans' as StrapiLocale, // 简体中文
'en': 'en' as StrapiLocale // 英文
};
const productions = ref<ProductionInfo[]>();
onMounted(async () => {
try {
const response = await find<Production>('productions', {
populate: '*',
locale: strapiLocales[i18nLocale.value], // 使用简体中文
locale: strapiLocale, // 使用简体中文
})
productions.value = response.data.map((item: Production) => {