1

我对 Gatsby 有疑问,我在 WordPress 中的链接关系中存在类型冲突

Fields "button" conflict because they return conflicting types AcfLink and String. Use different aliases on the fields to fetch both if this was intentional.

 Error path: undefined

在查询请求中

button {
      url
      title
    }

我该如何解决这个冲突

4

1 回答 1

0

您可以为这两个字段设置别名:

button {
      newName1: url
      newName2: title
    }

之后,您将需要分别使用button.newName1和引用每个字段button.newName2

GraphQL 别名文档:https ://graphql.org/learn/queries/#aliases

于 2022-03-04T09:54:37.820 回答