Update useFormEvents.ts (#514)

fix: 修复 表单回显时,参数为null或者''时, 报Invalid date的错
This commit is contained in:
最后 2021-04-22 21:14:42 +08:00 committed by GitHub
parent f4af231172
commit e689ee5fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -67,13 +67,13 @@ export function useFormEvents({
// time type
if (itemIsDateType(key)) {
if (Array.isArray(value)) {
const arr: moment.Moment[] = [];
const arr: any[] = [];
for (const ele of value) {
arr.push(dateUtil(ele));
arr.push(ele ? dateUtil(ele) : null);
}
formModel[key] = arr;
} else {
formModel[key] = dateUtil(value);
formModel[key] = value ? dateUtil(value) : null;
}
} else {
formModel[key] = value;