mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2026-01-14 06:57:09 +08:00
feat: GiForm 支持 label 自定义渲染,以及插槽自定义渲染(同步 GiDemo 更新)
This commit is contained in:
@@ -7,9 +7,13 @@
|
||||
:span="item.span || options.gridItem?.span"
|
||||
>
|
||||
<a-form-item
|
||||
v-bind="item.formItemProps" :label="item.label" :field="item.field" :rules="item.rules"
|
||||
v-bind="item.formItemProps" :field="item.field" :rules="item.rules"
|
||||
:disabled="isDisabled(item.disabled)"
|
||||
>
|
||||
<template #label>
|
||||
<template v-if="typeof item.label === 'string'">{{ item.label }}</template>
|
||||
<component :is="item.label" v-else></component>
|
||||
</template>
|
||||
<slot
|
||||
v-if="!['group-title'].includes(item.type || '')" :name="item.field"
|
||||
v-bind="{ disabled: isDisabled(item.disabled) }"
|
||||
@@ -25,7 +29,12 @@
|
||||
:is="`a-${item.type}`" v-else v-bind="getComponentBindProps(item)"
|
||||
:model-value="modelValue[item.field as keyof typeof modelValue]"
|
||||
@update:model-value="valueChange($event, item.field)"
|
||||
></component>
|
||||
>
|
||||
<template v-for="(slotValue, slotKey) in item?.slots" :key="slotKey" #[slotKey]>
|
||||
<template v-if="typeof slotValue === 'string'">{{ slotValue }}</template>
|
||||
<component :is="slotValue" v-else></component>
|
||||
</template>
|
||||
</component>
|
||||
</slot>
|
||||
<slot v-else name="group-title">
|
||||
<a-alert v-bind="item.props">{{ item.label }}</a-alert>
|
||||
|
||||
Reference in New Issue
Block a user