它没有在我的网站中显示数据。有什么问题我找不到它。请帮助我,对不起。 url 包含 json 数据并包含“featured”键。下面是我的代码。
<template>
<q-card v-for="article in formattedJSON.featured" :key="article.id">
<q-img :src="article.image" @load="imageLoaded" />
<q-card-section>
<NuxtLink
:to="article.channel.url"
class="text-channel text-caption q-mb-sm text-uppercase text-weight-bold"
style="text-decoration: none"
>{{ article.channel.name }}
</NuxtLink>
<p class="q-mb-sm text-header4">{{ article.title }}</p>
<p class="q-mb-xl text-data">{{ article.blurb }}</p>
</q-card-section>
</q-card>
</template>
<script setup>
const { data: formattedJSON } = await useFetch(
"https://featured/get/");
</script>`
在页面中显示图像、频道名称、标题和简介等数据。
您可能想尝试使用 JSON.parse(formattedJSON.featured),因为特色数据可能不是预期的对象格式。