mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-15 05:10:47 +08:00
fix: 增加点击获取参数功能
This commit is contained in:
parent
5edd3ef981
commit
8e2923da97
@ -1,10 +1,8 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Row, Radio, Icon, Input, Select } from 'antd';
|
||||
import { Row, Icon, Input, Select } from 'antd';
|
||||
// import common from 'common/power-string.js'
|
||||
const Option = Select.Option;
|
||||
const RadioButton = Radio.Button;
|
||||
const RadioGroup = Radio.Group;
|
||||
|
||||
// 深拷贝
|
||||
function deepEqual(state) {
|
||||
@ -84,11 +82,9 @@ class MethodsList extends Component {
|
||||
|
||||
let newList = deepEqual(this.state.list);
|
||||
newList[paramsIndex].params[0] = value;
|
||||
// console.log('newList', newList);
|
||||
this.setState({
|
||||
list: newList
|
||||
})
|
||||
// console.log('list', this.state.list);
|
||||
this.props.paramsInput(value, clickIndex);
|
||||
}
|
||||
|
||||
@ -109,17 +105,6 @@ class MethodsList extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
handleRadioChange = (e) => {
|
||||
console.log(e);
|
||||
this.state.list.forEach(item => {
|
||||
if (item.name === clickValue) {
|
||||
|
||||
}
|
||||
})
|
||||
this.props.click(e);
|
||||
// console.log('state', this.state.index);
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
const { list, moreFlag } = this.state;
|
||||
@ -137,25 +122,20 @@ class MethodsList extends Component {
|
||||
type="flex"
|
||||
align="middle"
|
||||
className={'row methods-row ' + (item.name === clickValue ? 'checked' : '')}
|
||||
onClick={() => click(item.name)}>
|
||||
onClick={() => click(item.name,showList[index].params)}>
|
||||
<span>{item.name}</span>
|
||||
<span className="input-component">
|
||||
{item.type && this.handleComponent(item, clickIndex, index)}
|
||||
</span>
|
||||
|
||||
|
||||
</Row>
|
||||
})
|
||||
}
|
||||
{
|
||||
moreFlag && <div className="show-more" onClick={this.showMore}><Icon type="down" /><span style={{ paddingLeft: '4px' }}>更多</span></div>
|
||||
}
|
||||
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default MethodsList;
|
@ -1,10 +1,8 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Row, Input, Radio } from 'antd';
|
||||
import { Row, Input } from 'antd';
|
||||
import constants from '../../constants/variable.js'
|
||||
const wordList = constants.MOCK_SOURCE;
|
||||
const RadioButton = Radio.Button;
|
||||
const RadioGroup = Radio.Group;
|
||||
const Search = Input.Search;
|
||||
|
||||
|
||||
|
@ -14,14 +14,14 @@ function deepEqual(state) {
|
||||
}
|
||||
|
||||
function closeRightTabsAndAddNewTab(arr, index, curname, params) {
|
||||
console.log(params);
|
||||
// console.log(params);
|
||||
let newParamsList = [].concat(arr);
|
||||
newParamsList.splice(index + 1, newParamsList.length - index);
|
||||
newParamsList.push({
|
||||
name: '', params: []
|
||||
})
|
||||
|
||||
let curParams = params&¶ms.name ===curname ? params.params:[];
|
||||
let curParams = params || [];
|
||||
newParamsList[index] = {
|
||||
...newParamsList[index],
|
||||
name: curname,
|
||||
@ -56,9 +56,9 @@ class ModalPostman extends Component {
|
||||
}
|
||||
|
||||
mockClick(index) {
|
||||
return (e, params) => {
|
||||
return (curname, params) => {
|
||||
console.log('value', params);
|
||||
let curname = e;
|
||||
// let curname = e;
|
||||
let newParamsList = closeRightTabsAndAddNewTab(this.state.methodsParamsList, index, curname, params)
|
||||
this.setState({
|
||||
methodsParamsList: newParamsList
|
||||
|
Loading…
Reference in New Issue
Block a user