mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 18:03:50 +00:00
[web] Simplify the code. (#2085)
This commit is contained in:
parent
c397a21980
commit
6479bd4e76
@ -11,7 +11,7 @@ export default class FilterDocs extends Component {
|
|||||||
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props, context)
|
super(props, context)
|
||||||
this.state = { doc: FilterDocs.doc, selectHandler: props.selectHandler}
|
this.state = { doc: FilterDocs.doc }
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
@ -29,10 +29,6 @@ export default class FilterDocs extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick(e, value){
|
|
||||||
this.state.selectHandler(value.split(" ")[0] + " ")
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { doc } = this.state
|
const { doc } = this.state
|
||||||
return !doc ? (
|
return !doc ? (
|
||||||
@ -41,7 +37,7 @@ export default class FilterDocs extends Component {
|
|||||||
<table className="table table-condensed">
|
<table className="table table-condensed">
|
||||||
<tbody>
|
<tbody>
|
||||||
{doc.commands.map(cmd => (
|
{doc.commands.map(cmd => (
|
||||||
<tr key={cmd[1]} onClick={e => this.handleClick(e, cmd[0])}>
|
<tr key={cmd[1]} onClick={e => this.props.selectHandler(cmd[0].split(" ")[0] + " ")}>
|
||||||
<td>{cmd[0].replace(' ', '\u00a0')}</td>
|
<td>{cmd[0].replace(' ', '\u00a0')}</td>
|
||||||
<td>{cmd[1]}</td>
|
<td>{cmd[1]}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user