【发布时间】:2020-09-27 11:47:59
【问题描述】:
我在/src/assests/images/basketball 中有图像,我想使用 graphiql 进行查询。
我尝试将其粘贴到我的 graphiql 中
query {
placeholderImage: file(relativePath: { eq: "basketball.jpeg" }) {
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid
}
}
}
}
但它一直说...GatsbyImageSharpFluid 未知片段。我对 graphQL 有一个模糊的想法,但有人可以帮我了解如何在 gatsby 中使用 graphiQl 查询查询吗?
这是我的 gatsby.config.js
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/assests/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
// icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
还有我的文件所在的文件夹结构
【问题讨论】: