feat(form): helpMessage Increase function type value (#616)

* feat(form): helpMessage

* feat(form): helpMessage
This commit is contained in:
Mikasa33 2021-05-18 23:04:31 +08:00 committed by GitHub
parent 0e440f0793
commit f455fb97f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -261,13 +261,14 @@
) : (
label
);
if (!helpMessage || (Array.isArray(helpMessage) && helpMessage.length === 0)) {
const getHelpMessage = isFunction(helpMessage) ? helpMessage(unref(getValues)) : helpMessage;
if (!getHelpMessage || (Array.isArray(getHelpMessage) && getHelpMessage.length === 0)) {
return renderLabel;
}
return (
<span>
{renderLabel}
<BasicHelp placement="top" class="mx-1" text={helpMessage} {...helpComponentProps} />
<BasicHelp placement="top" class="mx-1" text={getHelpMessage} {...helpComponentProps} />
</span>
);
}

View File

@ -125,7 +125,7 @@ export interface FormSchema {
// Auxiliary text
subLabel?: string;
// Help text on the right side of the text
helpMessage?: string | string[];
helpMessage?: string | string[] | ((renderCallbackParams: RenderCallbackParams) => string | string[]);
// BaseHelp component props
helpComponentProps?: Partial<HelpComponentProps>;
// Label width, if it is passed, the labelCol and WrapperCol configured by itemProps will be invalid