yapi/client/containers/Interface/InterfaceList/InterfaceList.js

36 lines
901 B
JavaScript
Raw Normal View History

2017-07-11 19:12:13 +08:00
import React, { Component } from 'react'
2017-07-13 20:09:04 +08:00
import PropTypes from 'prop-types'
2017-07-20 15:38:25 +08:00
import { Link } from 'react-router-dom'
2017-07-26 15:38:34 +08:00
import { Button } from 'antd'
2017-07-11 19:12:13 +08:00
class InterfaceList extends Component {
2017-07-13 20:09:04 +08:00
static propTypes = {
2017-07-14 11:27:34 +08:00
projectMember: PropTypes.func
2017-07-13 20:09:04 +08:00
}
2017-07-11 19:12:13 +08:00
constructor(props) {
super(props)
}
2017-07-25 17:41:58 +08:00
getInterfaceId () {
const reg = /Interface\/(\d+)/g
const url = location.href
url.match(reg)
return RegExp.$1
}
2017-07-11 19:12:13 +08:00
render () {
2017-07-13 20:09:04 +08:00
const { projectMember } = this.props
2017-07-25 17:41:58 +08:00
const getInterfaceId = this.getInterfaceId()
2017-07-26 16:25:34 +08:00
2017-07-11 19:12:13 +08:00
return (
2017-07-26 15:38:34 +08:00
<div className="interface-btngroup">
<Link to={`/AddInterface/${getInterfaceId}`}><Button className="interface-btn" type="primary" icon="plus">添加接口</Button></Link>
<Button className="interface-btn" type="primary" onClick={projectMember} icon="user">管理成员</Button>
</div>
2017-07-11 19:12:13 +08:00
)
}
}
2017-07-25 17:41:58 +08:00
export default InterfaceList