index.js 1.08 KB
Newer Older
bert committed
1 2 3 4 5
import React, {PropTypes} from 'react'
import { bindActionCreators } from 'redux'
import { Breadcrumb } from 'antd'
import { connect } from 'react-redux'

bert committed
6
import styles from './index.less'
bert committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

const defaultProps = {
  navpath: []
}

const propTypes = {
  navpath: PropTypes.array
}

class NavPath extends React.Component {
  constructor (props) {
    super(props)
  }

  render () {
    const { navpath } = this.props
    const bread = navpath.map((item)=>{
      return (
        <Breadcrumb.Item key={'bc-'+item.key}>{item.name}</Breadcrumb.Item>
      )
    })
    const breadInit = <Breadcrumb.Item key={'bc-myMain'}>我的发布</Breadcrumb.Item>
    return (
bert committed
30
      <div className={styles["ant-layout-breadcrumb"]}>
bert committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
        <Breadcrumb>
          <Breadcrumb.Item key='bc-0'>首页</Breadcrumb.Item>
          {bread.length == 0? breadInit: bread}
        </Breadcrumb>
      </div>
    )
  }
}

NavPath.propTypes = propTypes;
NavPath.defaultProps = defaultProps;

function mapStateToProps(state) {
  return {
    // navpath: state.menu.navpath
  }
}

export default connect(mapStateToProps)(NavPath)