index.js 1022 Bytes
Newer Older
wangshuo committed
1 2
import React, {Component} from 'react'
import './index.scss';
xuzhenghua committed
3

wangshuo committed
4 5 6 7
class HeaderBar extends Component {
    constructor(props) {
        super(props);
    }
xuzhenghua committed
8

wangshuo committed
9 10 11 12 13 14
    goBack = () => {
        window.history.go(-1);
    }
    goShop = () => {
        location.replace('/shopcart');
    }
xuzhenghua committed
15

wangshuo committed
16 17 18
    render() {
        return (
            <div className="detail-header" style={{...this.props.style}}>
xuzhenghua committed
19 20 21 22
                {
                    this.props.arrow &&
                    <i className='iconfont iconiconfront-68' onClick={this.goBack}></i>
                }
wangshuo committed
23
                <span className='herder'>{this.props.title}</span>
xuzhenghua committed
24 25 26 27 28 29 30 31
                {
                    this.props.cart &&
                    <i className='iconfont icongouwuche-xianxing' onClick={this.goShop}></i>
                }
                {
                    this.props.delete &&
                    <i className='iconfont iconiconfront-56' onClick={this.props.toDelete}></i>
                }
wangshuo committed
32 33 34
            </div>
        );
    }
xuzhenghua committed
35 36 37
};

export default HeaderBar;