import React, {Component} from 'react' import {NavBar, Icon, ActivityIndicator} from 'antd-mobile' import {productbyid} from "../../../utils/gql" import {Query} from "react-apollo" import gql from "graphql-tag" import './index.css' import {withRouter} from 'react-router-dom' class Detail 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 return (
} onLeftClick={() => {this.props.history.push({pathname: '/'})}} rightContent={[ , ]} >商品详情
{ ({loading, error, data}) => { if (loading) { return (
) } if (error) { return 'error!' } return ( ) } }
) } } export default withRouter(Detail) class DetailRender extends Component { constructor(props) { super(props) this.state = { } } render() { let {data} = this.props; return (
{data.name}
{data.price}
{data.stock}
详情详情
购物车
店铺
加入购物车
立即购买
) } }