我想从此响应中显示FeaturedImage-> mediaItemUrl,我能够映射authorId和标题,但如何获取图像的媒体URL
const ALL_BLOGS = gql`
{
posts(last: 10) {
nodes {
authorId
guid
title
commentCount
commentStatus
author {
node {
name
}
}
date
pinged
uri
featuredImage {
node {
mediaItemUrl
}
}
}
}
}
这是ReactJS代码The code snippet
答案 0 :(得分:0)
在您的代码段中,好像您忘记将node
放在mediaItemUrl
之前
{data.blog.featuredImage.map(featuredImage => (
<li key={featuredImage.node>
<h2>{featuredImage.node.mediaItemUrl}</h2>
</li>
))}