我目前正在使用hygraph api获取所有帖子。但我喜欢从结果集中筛选出前x项。所有帖子都减去了前x个项目,不知道怎么做。我使用的是hygraph的graphqlapi,以前称为graphcms。感谢您的帮助。
export const getPosts = async () => {
const query = gql`
query MyQuery {
postsConnection(orderBy: created_DESC) {
edges {
node {
author {
bio
name
id
photo {
url
}
}
created
updatedAt
slug
title
excerpt
featuredImage {
url
}
localizations {
id
locale
content {
raw
}
}
categories {
name
slug
}
words
}
}
}
}
`
const results = await graphQLClient.request(query);
return results.postsConnection.edges;
};
在查询参数中尝试跳过
query {
products(skip: x) {
id
}
}
https://hygraph.com/docs/api-reference/content-api/pagination#nested-分页