feat: 表单支持slot形式的自定义组件
This commit is contained in:
@ -233,6 +233,10 @@ export interface FormSchema {
|
||||
value?: any;
|
||||
subTitle?: string;
|
||||
isShow?: boolean;
|
||||
//自定义插槽名称 用于自定义组件
|
||||
slotName?: string;
|
||||
//无视权限一直显示 用于自定义组件
|
||||
ignorePermission?: boolean;
|
||||
}
|
||||
export interface HelpComponentProps {
|
||||
maxWidth: string;
|
||||
|
||||
@ -4,9 +4,12 @@
|
||||
<Row v-bind="getRow">
|
||||
<template v-for="schema in getSchemas" :key="schema.field">
|
||||
<Col v-if="getIfShow(schema, formModel[schema.field])" v-show="getIsShow(schema, formModel[schema.field])" :span="getColWidth(schema)">
|
||||
<template v-if="showComponent(schema)">
|
||||
<template v-if="showComponent(schema) && schema.type !== 'slot'">
|
||||
<SimpleFormItem v-model:value="formModel[schema.field]" :form-api="formApi" :isWorkFlow="isWorkFlow" :refreshFieldObj="refreshFieldObj" :schema="schema" />
|
||||
</template>
|
||||
<template v-if="schema.type === 'slot'">
|
||||
<slot :name="schema.slotName" :schema="schema" :formModel="formModel"></slot>
|
||||
</template>
|
||||
</Col>
|
||||
</template>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user