import React, {Component} from 'react' import {NavBar, Icon, ActivityIndicator, Grid} from 'antd-mobile' import {Input} from 'antd' import './index.css' import {productbyprops} from "../../../utils/gql" import {Query} from "react-apollo" import gql from "graphql-tag" import {withRouter} from 'react-router-dom' const Search = Input.Search class Kind extends Component { constructor(props) { super(props) this.state = { id: '' } } componentWillMount() { let {location} = this.props if(location && location.state) { this.setState({ id: location.state.id }) } } render() { let {id} = this.state let contentHeight = window.innerHeight - 105 return (
} onLeftClick={() => {this.props.history.push({pathname: '/'})}} >商品分类
console.log(value)} />
{ ({loading, error, data}) => { if (loading) { return (
) } if (error) { return 'error!' } return ( ) } }
) } } export default withRouter(Kind) class KindRender extends Component { constructor(props) { super(props) this.state = {} } render() { let {data} = this.props return (
{ data.length === 0? '这个分类还没有商品呢' : { this.props.history.push({ pathname: '/home/detail', state: { id: product.id } }) }} renderItem={dataItem => (
{dataItem.name}
{dataItem.price}
)} /> }
) } }