Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into antdv-next

This commit is contained in:
dap
2026-03-31 10:07:28 +08:00
25 changed files with 307 additions and 75 deletions

View File

@@ -48,6 +48,7 @@ const {
modelPropName,
renderComponentContent,
rules,
help,
} = defineProps<
Props & {
commonComponentProps: MaybeComponentProps;
@@ -166,6 +167,18 @@ const computedProps = computed(() => {
};
});
// 自定义帮助信息
const computedHelp = computed(() => {
const helpContent = help;
if (!helpContent) {
return undefined;
}
return () =>
isFunction(helpContent)
? helpContent(values.value, getFormApi())
: helpContent;
});
watch(
() => computedProps.value?.autofocus,
(value) => {
@@ -308,7 +321,7 @@ onUnmounted(() => {
labelClass,
)
"
:help="help"
:help="computedHelp"
:colon="colon"
:label="label"
:required="shouldRequired && !hideRequiredMark"

View File

@@ -67,6 +67,14 @@ export type FormActions = FormContext<GenericObject>;
export type CustomRenderType = (() => Component | string) | string;
// 动态渲染参数
export type CustomParamsRenderType =
| ((
value: Partial<Record<string, any>>,
actions: FormActions,
) => Component | string)
| string;
export type FormSchemaRuleType =
| 'required'
| 'selectRequired'
@@ -254,7 +262,7 @@ export interface FormSchema<
/** 字段名 */
fieldName: string;
/** 帮助信息 */
help?: CustomRenderType;
help?: CustomParamsRenderType;
/** 是否隐藏表单项 */
hide?: boolean;
/** 表单项 */