Browse Source

add slot to Formitem

pull/702/head
cKey 3 years ago
parent
commit
bbdaf23c1a
  1. 2
      apps/vue/src/components/Form/src/TabForm.vue
  2. 3
      apps/vue/src/components/Form/src/components/FormItem.vue
  3. 3
      apps/vue/src/components/Form/src/types/form.ts

2
apps/vue/src/components/Form/src/TabForm.vue

@ -21,7 +21,9 @@
<Row v-bind="getRow">
<slot name="formHeader"></slot>
<template v-for="schema in tabSchema.schemas" :key="schema.field">
<slot v-if="schema.tabSlot" :name="schema.tabSlot"></slot>
<FormItem
v-else
:tableAction="tableAction"
:formActionType="formActionType"
:schema="schema"

3
apps/vue/src/components/Form/src/components/FormItem.vue

@ -317,7 +317,7 @@
}
function renderItem() {
const { itemProps, slot, render, field, suffix, component } = props.schema;
const { itemProps, slot, render, field, suffix, component, extra } = props.schema;
const { labelCol, wrapperCol } = unref(itemLabelWidthProp);
const { colon } = props.formProps;
@ -354,6 +354,7 @@
<div style="flex:1;">{getContent()}</div>
{showSuffix && <span class="suffix">{getSuffix}</span>}
</div>
{ getSlot(slots, extra) }
</Form.Item>
);
}

3
apps/vue/src/components/Form/src/types/form.ts

@ -145,6 +145,8 @@ export interface FormSchema {
label: string | VNode;
// Auxiliary text
subLabel?: string;
// extra
extra?: string;
// Help text on the right side of the text
helpMessage?:
| string
@ -219,6 +221,7 @@ export interface FormSchema {
export interface TabFormSchema extends FormSchema {
tab: string;
tabSlot?: string;
}
export interface HelpComponentProps {

Loading…
Cancel
Save