mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 02:00:25 +08:00
fix: bug RangePicker with componentProps valueFormat ('YYYY-MM-DD') does not return the formatted value when using form validate() method #3690 (#3691)
close #3690
This commit is contained in:
parent
c1809cd6c5
commit
09f795e00e
@ -135,6 +135,9 @@ export function useFormEvents({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const constructValue = tryConstructArray(key, values) || tryConstructObject(key, values);
|
const constructValue = tryConstructArray(key, values) || tryConstructObject(key, values);
|
||||||
|
const setDateFieldValue = (v) => {
|
||||||
|
return v ? (_props?.valueFormat ? v : dateUtil(v)) : null;
|
||||||
|
};
|
||||||
|
|
||||||
// 0| '' is allow
|
// 0| '' is allow
|
||||||
if (hasKey || !!constructValue) {
|
if (hasKey || !!constructValue) {
|
||||||
@ -144,15 +147,11 @@ export function useFormEvents({
|
|||||||
if (Array.isArray(fieldValue)) {
|
if (Array.isArray(fieldValue)) {
|
||||||
const arr: any[] = [];
|
const arr: any[] = [];
|
||||||
for (const ele of fieldValue) {
|
for (const ele of fieldValue) {
|
||||||
arr.push(ele ? dateUtil(ele) : null);
|
arr.push(setDateFieldValue(ele));
|
||||||
}
|
}
|
||||||
unref(formModel)[key] = arr;
|
unref(formModel)[key] = arr;
|
||||||
} else {
|
} else {
|
||||||
unref(formModel)[key] = fieldValue
|
unref(formModel)[key] = setDateFieldValue(fieldValue);
|
||||||
? _props?.valueFormat
|
|
||||||
? fieldValue
|
|
||||||
: dateUtil(fieldValue)
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unref(formModel)[key] = fieldValue;
|
unref(formModel)[key] = fieldValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user