Browse Source
feat(form): helpMessage Increase function type value (#616)
* feat(form): helpMessage
* feat(form): helpMessage
pull/620/head
Mikasa33
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
3 deletions
-
src/components/Form/src/components/FormItem.vue
-
src/components/Form/src/types/form.ts
|
|
|
@ -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> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -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
|
|
|
|
|