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

35 lines
799 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-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()
console.log(`/AddInterface/${getInterfaceId}`)
2017-07-11 19:12:13 +08:00
return (
<ul className="interface-list">
2017-07-25 17:41:58 +08:00
<li><Link to={`/AddInterface/${getInterfaceId}`}>添加接口</Link></li>
2017-07-13 20:09:04 +08:00
<li onClick={projectMember}>管理项目成员</li>
2017-07-11 19:12:13 +08:00
</ul>
)
}
}
2017-07-25 17:41:58 +08:00
export default InterfaceList