以前知道react 组件中新增属性可以用…解构对象直接放进去,但是这样加判断进去也是第一次用
<Button type="link" {...{ "disabled": row.lineStatus == 2 ? true : false }} onClick={() => row.lineStatus == 2 ? false : handlerAction(row, 'edite')} title="编辑">
<BdpIcon type="iconbianji1" color="#3954FF" {...{ "color": row.lineStatus == 2 ? '#DDD' : '#3954FF' }}>
</BdpIcon>
</Button>
新增了一个
{
title: '字段',
dataIndex: 'targetField',
key: 'targetField',
render: (text, record, index) => {
return <Item
{
...(!text && {//这里重要
validateStatus: "error",
help: "请输入目标表字段"
})
}
>
{getFieldDecorator('targetField' + (record.key - 1), {
initialValue: text || record.name,
rules: [{ required: true, message: '请输入目标表字段' }]
})(
<Input onChange={(e) => { this.changeTargetField(e, record, index) }} disabled={previewChecked}></Input>
)}
</Item>
}