mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-05-11 05:02:10 +08:00
Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into antdv-next
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
/** 表单项 */
|
||||
|
||||
Reference in New Issue
Block a user