typeerror:date.clone在添加“名称”之后不是函数。属性形成。项目(蚂蚁设计)
我目前正在使用Ant Design的DatePicker构建一个应用程序,并且我正在使用Form.Item包装。
<Form.Item
name={key}
label={label}
>
<DatePicker
disabledDate={(current) => disableDaysAfterToday(current)}
onChange={(current) => handleChangeDate(current)}
/>
</Form.Item>
但是,当“名称”属性被添加到form.item组件我最终会遇到以下错误时:typeError:date.clone不是函数。而且,如果我删除此属性或更改为其他字符串,即从表单中删除“名称”。信息正常工作。有人可以帮我吗?
I am currently building an application with DatePicker from Ant Design and I am wrapping with Form.item.
<Form.Item
name={key}
label={label}
>
<DatePicker
disabledDate={(current) => disableDaysAfterToday(current)}
onChange={(current) => handleChangeDate(current)}
/>
</Form.Item>
However, when the "name" property is added to the Form.Item component I end up getting the following error: TypeError: date.clone is not a function. And, if I remove this property or change to some other string, that is, remove "name" from the Form.Item everything works normally. Can anybody help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“名称”属性用于在您的
&lt; form/&gt;
Component中提供的“初始值”中选择正确的属性。如果您不告知它,它不会因选择属性而破裂,您的输入一定是空的。对我来说,当我将其处理到“初始价值”之前对待相关属性时,它起作用了。
The "name" property is used to select the correct attribute in the "initialValues" provided in your
<Form/>
component. If you don't inform it, it doesn't break because the attribute is not being selected, your input must have been empty.For me, it worked when I treated the attribute in question before passing it to "initialValues".