import React, { Component } from 'react' import { Select, Input } from 'antd' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { autobind } from 'core-decorators' import { reqTagValue, reqHeaderValue, deleteReqHeader } from '../../../actions/addInterface.js' @connect( state => { return { seqGroup: state.addInterface.seqGroup, tagValue: state.addInterface.tagValue, headerValue: state.addInterface.headerValue, reqTagValue: state.addInterface.reqTagValue, reqHeaderValue: state.addInterface.reqHeaderValue } }, { reqTagValue, reqHeaderValue, deleteReqHeader } ) class ReqList extends Component { static propTypes = { headerValue: PropTypes.string, seqGroup: PropTypes.array, tagValue: PropTypes.string, reqTagValue: PropTypes.func, reqHeaderValue: PropTypes.func, deleteReqHeader: PropTypes.func, dataNum: PropTypes.number } constructor(props) { super(props) } @autobind handleChange (value) { this.props.reqTagValue(value) } @autobind handleBlur (e) { const value = e.target.value this.props.reqHeaderValue(value) } @autobind deleteReqHeader (e) { let newSeqGroup = [] let seqGroup = this.props.seqGroup let dataNum = e.target.getAttribute('data-num') seqGroup.map(value => { if (+dataNum !== value.id) { newSeqGroup.push(value) } }) this.props.deleteReqHeader(newSeqGroup) } render () { const Option = Select.Option const dataNum = this.props.dataNum return (
  • 头部标签 {this.props.tagValue} {this.props.headerValue} 头部内容 ×
  • ) } } export default ReqList