|
|
|
@ -77,11 +77,21 @@ const getBindValue = computed(() => ({ ...attrs, ...props, ...unref(getProps) })
|
|
|
|
|
const getSchema = computed((): FormSchema[] => { |
|
|
|
|
const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any) |
|
|
|
|
for (const schema of schemas) { |
|
|
|
|
const { defaultValue, component, isHandleDateDefaultValue = true } = schema |
|
|
|
|
const { |
|
|
|
|
defaultValue, |
|
|
|
|
component, |
|
|
|
|
componentProps, |
|
|
|
|
isHandleDateDefaultValue = true, |
|
|
|
|
} = schema |
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line dot-notation |
|
|
|
|
const valueFormat = componentProps ? componentProps['valueFormat'] : null |
|
|
|
|
// handle date type |
|
|
|
|
if (isHandleDateDefaultValue && defaultValue && dateItemType.includes(component)) { |
|
|
|
|
if (!Array.isArray(defaultValue)) { |
|
|
|
|
schema.defaultValue = dateUtil(defaultValue) |
|
|
|
|
schema.defaultValue = valueFormat |
|
|
|
|
? dateUtil(defaultValue).format(valueFormat) |
|
|
|
|
: dateUtil(defaultValue) |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
const def: any[] = [] |
|
|
|
|