2017-06-22 51 views

回答

1

你在设置getConnectionFromProps吗?
可能需要像props.todos。

module.exports = createPaginationContainer(
    Todos, 
    { 
    todos: graphql` 
     todos(first: $count # count is default to 2 
     ) @connection(key: "TodoList_todos") { # 
      edges { 
       cursor 
       node { 
       id, 
       complete, 
       ...Todo_todo, 
      } 
      } 
      pageInfo { 
       endCursor 
       hasNextPage 
       hasPreviousPage 
       startCursor 
      } 
    ` 
    }, 
    { 
    direction: 'forward', 
    getConnectionFromProps: props => props.todos, 
    getFragmentVariables: (vars, totalCount) => ({ 
     ...vars, 
     count: totalCount, 
    }), 
    getVariables: (props, {count, cursor}) => ({ 
     count, 
     cursor 
    }), 
    environment: environment, 
    query: graphql` 
     query TodosPaginationQuery($count: Int!, $cursor: String) { 
     ...ShopList_shops 
     } 
    ` 
    } 
); 
相关问题