antd Form级联元素回显
程序员文章站
2022-04-05 11:10:10
...
editRow = key => {
this.dispatch({
type: 'project/detailProject',
payload: {
key,
},
callback: data => {
this.setState({
// 拿到回显数据之后设置子级的选项列表
stage: stageData[data.trade],
});
},
});
this.setState({
drawerVisible: true,
drawerTitle: '编辑',
});
};
const {stage} = this.state
<Form.Item label="项目阶段">
{getFieldDecorator('stage', {
initialValue: project.stage,
rules: [{ required: true, message: '请选择项目阶段' }],
})(
<Select notFoundContent="请先选择项目行业">
{stage.map(item => (
<Select.Option value={item.key} key={item.key}>
{item.name}
</Select.Option>
))}
</Select>
)}
</Form.Item>