Fix: 修正国际化的显示、跳转问题
This commit is contained in:
@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user