我试着在没有无限滚动的情况下编码分页。我希望能够点击页码并相应地更新前后的光标。当光标位于该页上的最后一条记录时。我不确定这是否是最好的方法。第一次接力。我不知道如何根据条件动态地改变我的容器。有时我不会有后遗症或前遗症。我传递的是空字符串,但是relay抱怨graphql查询工具不能这样做。
1] Warning: GraphQLRange cannot find a segment that has the cursor:
[1] GraphQLRange cannot find a segment that has the cursor:
export default Relay.createContainer(Search,{
initialVariables: {
pageSize: 20,
lastRecord:""
},
fragments: {
Viewer: () => Relay.QL`
fragment on Viewer {
User_Email,
Books (first: $pageSize, after: $lastRecord) {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
startCursor,
endCursor
}
edges{
cursor,
node{
Title,
id,
Pub_Date,
}
}
}
}
`
}
});这是一种好的方法吗?还有没有其他人想这么做。你读到的每一篇文章都是无限滚动的。
发布于 2016-08-11 03:16:20
要避免此错误,请将lastRecord变量设置为null,而不是空字符串。
initialVariables: {
pageSize: 20,
lastRecord:null
}https://stackoverflow.com/questions/38311712
复制相似问题