页面中使用了日期组件,新增没问题,在编辑赋值时报错,赋值的日期格式receiptDate: "2021-09-17"

date.clone is not a function

 

看了一下文档,

DatePicker与

TimePicker的value值需要moment属性

antd 报错date.clone is not a function

所以拿到值后,对日期进行转换

引入moment

import moment from 'moment'
 
对获取的数据进行日期格式转换
Reflect.set(formData, 'receiptDate', moment(formData.receiptDate))
 
赋值给form组件
form.setFieldsValue({ ...formData })

相关文章:

  • 2021-06-19
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-10-25
  • 2022-01-23
相关资源
相似解决方案