可以从动态区域内获取来自嵌套组件的数据

发布于 2025-02-11 23:15:38 字数 821 浏览 0 评论 0 原文

与Strapi论坛有关 - >

是否有任何弹性的方法来请求动态区域通过GraphQl而不明确定义它们在查询中? 例如,我不想做这样的事情:

query Homepage {
  components {
    ... on SliderComponent {
      image
      text
    }
    ... on ParagraphComponent {
      title
      description
    }
    // and so on...
  }
}

相反,我希望能够在不单独查询的情况下获得所有动态区域。 因此,理想情况下将是这样的事情:

query Homepage {
  components
}

这将返回所有可能的动态区域组件及其嵌套字段。

最好的情况是使用RESTAPI http:// localhost中的内容查询动态区域中的所有嵌套数据:1337/api/pages?pupulate [dynamiczones]

注意:我知道上面的查询不正确,是不正确的,但这只是查询形状的想法。

Related to Strapi forum -> https://forum.strapi.io/t/resolved-cant-get-the-data-from-nested-components-within-dynamic-zones/15896/3

Is there any elastic way to request dynamic zones via Graphql without explicitly defining each of them in a query?
For example, I DON’T want to do something like this:

query Homepage {
  components {
    ... on SliderComponent {
      image
      text
    }
    ... on ParagraphComponent {
      title
      description
    }
    // and so on...
  }
}

Instead, somehow, I’d like to be able to get all of the dynamic zones without querying them separately.
So ideally would be something like this:

query Homepage {
  components
}

and that would return all of the possible dynamic zone components with their nested fields.

The best scenario is to query all the nested data within the dynamic zones using something like in RestApi http://localhost:1337/api/pages?populate[dynamiczones]

NOTE: I know that the queries above are not correct, but this is just an idea of the query shape.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文