我有一个内容丰富的页面,我使用 graphql 将内容检索到我的反应应用程序中。在这个页面中,一个名为 Person 的内容模型的链接是这样的:
{
"name": "Person",
"description": "",
"displayField": "name",
"fields": [
{
"id": "name",
"name": "Name",
"type": "Symbol",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "profilePic",
"name": "profile pic",
"type": "Link",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false,
"linkType": "Asset"
},
{
"id": "socialLinks",
"name": "social links",
"type": "Array",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false,
"items": {
"type": "Link",
"validations": [
{
"linkContentType": [
"socialLink"
]
}
],
"linkType": "Entry"
}
}
ProfilePic 是另一种内容模型,其中包括名称和 picUrl。socialLink
SocialLinks 是一个包含名称和链接的内容模型数组
我可以毫无问题地检索我的 profilePic 名称或 picUrl,但我无法获取 socialLinks。我已阅读有关一对多的内容丰富的文档,但我不清楚如何应用于我的案例:https ://www.contentful.com/developers/docs/references/graphql/#/reference/schema-generation /一对多多类型关系
我的查询:
...rest of the query..
founder{
name,
profilePic{
url,
title
},
socialLinksCollection {
items {
name,
link
}
}
},
... rest of the query...
somoene 能帮我理解为什么它不能作为一个正常的收藏吗?我应该使用这个概念linkedFrom
吗?但具体如何?