2017-07-28 17:30:56 +08:00
|
|
|
import './Breadcrumb.scss';
|
2017-08-28 17:24:17 +08:00
|
|
|
import { withRouter } from 'react-router-dom';
|
2017-07-28 17:30:56 +08:00
|
|
|
import { Breadcrumb } from 'antd';
|
2017-07-30 15:06:03 +08:00
|
|
|
import PropTypes from 'prop-types'
|
2017-07-28 17:30:56 +08:00
|
|
|
import React, { Component } from 'react';
|
2017-08-28 17:24:17 +08:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { Link } from 'react-router-dom'
|
2017-07-28 21:16:47 +08:00
|
|
|
|
2017-08-28 17:24:17 +08:00
|
|
|
@connect(
|
|
|
|
state => {
|
|
|
|
return {
|
|
|
|
breadcrumb: state.user.breadcrumb
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
2017-07-28 17:30:56 +08:00
|
|
|
@withRouter
|
|
|
|
export default class BreadcrumbNavigation extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2017-07-28 21:16:47 +08:00
|
|
|
}
|
2017-07-30 15:06:03 +08:00
|
|
|
static propTypes = {
|
2017-08-28 17:24:17 +08:00
|
|
|
breadcrumb: PropTypes.array
|
2017-07-30 15:06:03 +08:00
|
|
|
}
|
2017-08-28 17:24:17 +08:00
|
|
|
render () {
|
|
|
|
console.log(this.props.breadcrumb);
|
|
|
|
const getItem = this.props.breadcrumb.map((item, index) => {
|
|
|
|
console.log(item);
|
|
|
|
if (item.fref) {
|
|
|
|
return (<Breadcrumb.Item key={index}><Link to={item.href}>{item.name}</Link></Breadcrumb.Item>);
|
|
|
|
} else {
|
|
|
|
return (<Breadcrumb.Item key={index}>{item.name}</Breadcrumb.Item>);
|
2017-07-31 10:56:22 +08:00
|
|
|
}
|
2017-07-28 21:16:47 +08:00
|
|
|
})
|
2017-08-28 17:24:17 +08:00
|
|
|
return (<div className="breadcrumb-container">
|
|
|
|
<Breadcrumb>
|
|
|
|
{getItem}
|
|
|
|
</Breadcrumb>
|
|
|
|
</div>);
|
2017-07-28 17:30:56 +08:00
|
|
|
}
|
|
|
|
}
|