Skip to content

Commit

Permalink
feat: supprt initialValue for RenderFormItem (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyFBB committed Sep 8, 2022
1 parent 183519d commit 3abd052
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/renderFormItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ interface ItemType {
normalize?: any;
};
rules?: Rule[];
initialValue?: any;
};
layout?: {};
}

export default function RenderFormItem({ item, layout }: ItemType) {
const { label, key, required = true, component, options = {}, rules } = item;
const { label, key, required = true, component, options = {}, rules, initialValue } = item;
const { validateFirst = false, validateTrigger = 'onChange', valuePropName, normalize } = options;
return (
<FormItem
key={key}
name={key}
label={label}
{...layout}
initialValue={initialValue}
className={options.className}
rules={rules || [{ required, message: `${label} 为空` }]}
validateFirst={validateFirst}
Expand Down

0 comments on commit 3abd052

Please sign in to comment.