yapi/client/containers/Project/Project.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-08-10 16:00:52 +08:00
import React, { Component } from 'react'
import PropTypes from 'prop-types'
2017-08-10 20:56:08 +08:00
import { Route, Switch, Redirect } from 'react-router-dom';
import { Subnav } from '../../components/index'
2017-08-11 10:44:33 +08:00
import { Interface } from './Interface/Interface.js'
2017-08-10 16:00:52 +08:00
export default class GroupList extends Component {
static propTypes = {
2017-08-11 10:44:33 +08:00
match: PropTypes.object
2017-08-10 16:00:52 +08:00
}
state = {
}
constructor(props) {
super(props)
}
componentWillMount() {
}
render () {
2017-08-11 10:44:33 +08:00
const { match } = this.props;
2017-08-11 16:03:11 +08:00
console.log('project')
2017-08-10 16:00:52 +08:00
return (
<div>
2017-08-10 20:56:08 +08:00
<Subnav
default={'接口'}
data={[{
name: '接口',
2017-08-11 10:44:33 +08:00
path: `/project/${match.params.id}/interface`
2017-08-10 20:56:08 +08:00
}, {
name: '设置',
2017-08-11 10:44:33 +08:00
path: `/project/${match.params.id}/setting`
2017-08-10 20:56:08 +08:00
}, {
name: '动态',
2017-08-11 10:44:33 +08:00
path: `/project/${match.params.id}/activity`
2017-08-10 20:56:08 +08:00
}]}/>
2017-08-10 20:08:23 +08:00
<Switch>
2017-08-11 16:03:11 +08:00
<Redirect exact from ="/project/:id" to={`/project/${match.params.id}/activity`}/>
2017-08-10 20:08:23 +08:00
<Route path="/project/:id/activity" component={null} />
2017-08-11 10:44:33 +08:00
<Route path="/project/:id/interface" component={Interface} />
2017-08-10 20:08:23 +08:00
<Route path="/project/:id/setting" component={null} />
</Switch>
2017-08-10 16:00:52 +08:00
</div>
)
}
}