feat: form colon support (#5156)

This commit is contained in:
Netfan
2024-12-16 22:37:29 +08:00
committed by GitHub
parent 38805a0e1f
commit 593916d6aa
5 changed files with 33 additions and 11 deletions

View File

@@ -26,6 +26,7 @@ import { isEventObjectLike } from './helper';
interface Props extends FormSchema {}
const {
colon,
commonComponentProps,
component,
componentProps,
@@ -300,7 +301,10 @@ function autofocus() {
:required="shouldRequired && !hideRequiredMark"
:style="labelStyle"
>
{{ label }}
<template v-if="label">
<span>{{ label }}</span>
<span v-if="colon" class="ml-[2px]">:</span>
</template>
</FormLabel>
<div :class="cn('relative flex w-full items-center', wrapperClass)">
<FormControl :class="cn(controlClass)">

View File

@@ -86,6 +86,7 @@ const computedSchema = computed(
formFieldProps: Record<string, any>;
} & Omit<FormSchema, 'formFieldProps'>)[] => {
const {
colon = false,
componentProps = {},
controlClass = '',
disabled,
@@ -110,6 +111,7 @@ const computedSchema = computed(
: false;
return {
colon,
disabled,
disabledOnChangeListener,
disabledOnInputListener,

View File

@@ -136,6 +136,10 @@ type ComponentProps =
| MaybeComponentProps;
export interface FormCommonConfig {
/**
* 在Label后显示一个冒号
*/
colon?: boolean;
/**
* 所有表单项的props
*/