跳到主内容

antd vue TypeError: value.locale is not a function

· 1分钟阅读

问题

在使用 antd vue 版本编辑数据时,给DatePicker组件赋值会以下错误

antd vue TypeError: value.locale is not a function

原因

DatePicker组件需要 moment 格式的数据,直接赋值String类型会报错

解决

把时间字符串改为 moment 格式即可

this.startTime = moment(detail.startTime);