fix: 修改项目时只有最后一项有删除按钮

This commit is contained in:
wenbo.dong 2017-07-26 15:02:51 +08:00
parent a1c4c0ca7a
commit 1fa4df60ea

View File

@ -252,7 +252,7 @@ class UpDateModal extends Component {
})( })(
<Input placeholder="请输入环境域名" style={{ width: '90%', marginRight: 8 }} addonBefore={ <Input placeholder="请输入环境域名" style={{ width: '90%', marginRight: 8 }} addonBefore={
getFieldDecorator(`envs-protocol-${index}`, { getFieldDecorator(`envs-protocol-${index}`, {
initialValue: envMessage.length !== 0 && k.domain ? k.domain.split('\/\/')[0]+'\/\/' : '', initialValue: envMessage.length !== 0 && k.domain ? k.domain.split('\/\/')[0]+'\/\/' : 'http\:\/\/',
rules: [{ rules: [{
required: true required: true
}] }]
@ -266,11 +266,14 @@ class UpDateModal extends Component {
</FormItem> </FormItem>
</Col> </Col>
<Col span={2}> <Col span={2}>
{envs.length > 0 ? ( {/* 新增的项中,只有最后一项有删除按钮 */}
{ (envs.length > 0 && k._id) || (envs.length == index + 1) ? (
<Icon <Icon
className="dynamic-delete-button" className="dynamic-delete-button"
type="minus-circle-o" type="minus-circle-o"
onClick={() => this.remove(k._id ? k._id : k)} onClick={() => {
return this.remove(k._id ? k._id : k);
}}
/> />
) : null} ) : null}
</Col> </Col>