-
Notifications
You must be signed in to change notification settings - Fork 357
Open
Labels
🐞 bugSomething isn't workingSomething isn't working
Description
tdesign-react 版本
1.15.1
重现链接
https://codesandbox.io/p/sandbox/76gcnt
重现步骤
FormList 中嵌套 FormList 父元素的FormList添加表单项,值为{ a: "bj", b: [{ c: "bj" }] },但是结果并没有c的数据,使用initialData传递默认值视图上是有数据的,但是动态添加的没有
import React from "react";
import { MinusCircleIcon } from "tdesign-icons-react";
import { Button, Form, Input, Select } from "tdesign-react";
const { FormItem, FormList } = Form;
export default function BaseForm() {
const [form] = Form.useForm();
return (
<Form
form={form}
initialData={{
list: [
{
a: "bj",
b: [{ c: "bj" }],
},
],
}}
>
<FormList name="list">
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, index) => (
<FormItem key={key}>
<FormItem name={[name, "a"]} label="a">
<Input />
</FormItem>
<FormList name={["list", name, "b"]}>
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, index) => (
<FormItem key={key}>
<FormItem name={[name, "c"]} label="c">
<Input />
</FormItem>
</FormItem>
))}
</>
)}
</FormList>
<FormItem>
<MinusCircleIcon
size="20px"
style={{ cursor: "pointer" }}
onClick={() => remove(name)}
/>
</FormItem>
</FormItem>
))}
<FormItem style={{ marginLeft: 100 }}>
<Button
theme="default"
variant="dashed"
onClick={() =>
add({
a: "bj",
b: [{ c: "bj" }],
})
}
>
新增指定项
</Button>
</FormItem>
</>
)}
</FormList>
</Form>
);
}
期望结果
No response
实际结果
No response
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
No response
补充说明
No response
Metadata
Metadata
Assignees
Labels
🐞 bugSomething isn't workingSomething isn't working
Type
Projects
Status
No status