From 1b433d745fc8e92ee741d1243adf699507dc6cdf Mon Sep 17 00:00:00 2001 From: "waliang.wang" Date: Wed, 26 Jul 2017 21:10:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=B7=E6=B1=82=E5=A4=B4=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AddInterface/ReqHeader/ReqList.js | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/client/containers/AddInterface/ReqHeader/ReqList.js b/client/containers/AddInterface/ReqHeader/ReqList.js index 47e8da5a..4e3a6f83 100644 --- a/client/containers/AddInterface/ReqHeader/ReqList.js +++ b/client/containers/AddInterface/ReqHeader/ReqList.js @@ -50,7 +50,11 @@ class ReqList extends Component { if (url.includes(dir)) { const { seqGroup, value: { id } } = this.props - seqGroup[id].name = value + seqGroup.forEach(v => { + if (id == v.id) { + v.name = value + } + }) seqGroup.forEach(v => { const {id, name, value} = v newObject.push({id, name, value}) @@ -58,8 +62,16 @@ class ReqList extends Component { this.props.addReqHeader( newObject ) } else { const { seqGroup, dataNum } = this.props - seqGroup[dataNum].name = value - this.props.addReqHeader(Object.create(seqGroup)) + seqGroup.forEach(v => { + if (dataNum == v.id) { + v.name = value + } + }) + seqGroup.forEach(v => { + const {id, name, value} = v + newObject.push({id, name, value}) + }) + this.props.addReqHeader(newObject) } } @@ -68,7 +80,11 @@ class ReqList extends Component { const value = e.target.value const { seqGroup, value: { id } } = this.props const newObject = [] - seqGroup[id].value = value + seqGroup.forEach(v => { + if (id == v.id) { + v.value = value + } + }) seqGroup.forEach(v => { const {id, name, value} = v newObject.push({id, name, value}) @@ -93,9 +109,9 @@ class ReqList extends Component { render () { const propsValue = this.props.value const Option = Select.Option - const value = propsValue.value + const value = propsValue.value || '' const name = propsValue.name || '' - + console.log(name) return (
  • 头部标签 @@ -108,7 +124,7 @@ class ReqList extends Component { 头部内容 - +
  • )