typescript - Ant Design Form field with array of objects
问题描述
I want to edit an entity with one-to-many relation
{
id: 1,
title: 'Title',
tags: [
{ id: 1 },
{ id: 2 },
],
}
With the code
<Form.Item
name={["tags", "id"]}
>
<Select mode={'multiple'} {...selectProps} />
</Form.Item>
On submit I get such object:
{
id: 1,
title: 'Title',
tags: { id: [1, 2]},
}
How can I get tags as array of objects?
解决方案
Try using the normalize
callback on Form.Item
推荐阅读
- python - OVH Python API:创建实例不喜欢我的 JSON?
- python - 每次我发出请求时如何使用 Tor 更改 Selenium 的 IP 地址
- python - 根据来自另一个数组的值对来自一个 numpy 数组的值进行分组
- python - 如何让 HoughLinesP 更敏感?
- python - http.client 出现错误,说明 UnicodeErrorL 标签太长
- gitlab - 使用自定义域的 GitLab 页面和 Sphinx
- python - 值错误:要解包的值太多(预期为 2)
- pyspark - PySpark 滞后函数
- reactjs - 如何从reducer react-redux调度一个动作
- arrays - 从 Get-ADPrincipalGroupMembership 获取信息没有像我希望的那样工作