@@ -193,7 +193,7 @@ const fieldProps = computed(() => {
193193 const rules = fieldRules .value ;
194194 return {
195195 keepValue: true ,
196- label ,
196+ label: isString ( label ) ? label : ' ' ,
197197 ... (rules ? { rules } : {}),
198198 ... (formFieldProps as Record <string , any >),
199199 };
@@ -285,7 +285,7 @@ function autofocus() {
285285 ' pb-6' : ! compact ,
286286 ' pb-2' : compact ,
287287 } "
288- class="flex"
288+ class="relative flex"
289289 v-bind =" $attrs "
290290 >
291291 <FormLabel
@@ -305,55 +305,59 @@ function autofocus() {
305305 :style =" labelStyle "
306306 >
307307 <template v-if =" label " >
308- <span >{{ label }}</ span >
308+ <VbenRenderContent : content = " label " / >
309309 <span v-if =" colon" class =" ml-[2px]" >:</span >
310310 </template >
311311 </FormLabel >
312- <div :class =" cn('relative flex w-full items-center', wrapperClass)" >
313- <FormControl :class =" cn (controlClass )" >
314- <slot
315- v-bind =" {
316- ...slotProps,
317- ...createComponentProps(slotProps),
318- disabled: shouldDisabled,
319- isInValid,
320- }"
321- >
322- <component
323- :is =" FieldComponent"
324- ref =" fieldComponentRef"
325- :class =" {
326- 'border-destructive focus:border-destructive hover:border-destructive/80 focus:shadow-[0_0_0_2px_rgba(255,38,5,0.06)]':
312+ <div class =" w-full overflow-hidden" >
313+ <div :class =" cn('relative flex w-full items-center', wrapperClass)" >
314+ <div class =" flex-auto overflow-hidden" >
315+ <FormControl :class =" cn (controlClass )" >
316+ <slot
317+ v-bind =" {
318+ ...slotProps,
319+ ...createComponentProps(slotProps),
320+ disabled: shouldDisabled,
327321 isInValid,
328- }"
329- v-bind =" createComponentProps(slotProps)"
330- :disabled =" shouldDisabled"
331- >
332- <template
333- v-for =" name in renderContentKey "
334- :key =" name "
335- #[name ]=" renderSlotProps "
322+ }"
336323 >
337- <VbenRenderContent
338- :content =" customContentRender [name ]"
339- v-bind =" { ... renderSlotProps , formContext: slotProps } "
340- />
341- </template >
342- <!-- <slot></slot> -->
343- </component >
344- </slot >
345- </FormControl >
346- <!-- 自定义后缀 -->
347- <div v-if =" suffix" class =" ml-1" >
348- <VbenRenderContent :content =" suffix " />
324+ <component
325+ :is =" FieldComponent"
326+ ref =" fieldComponentRef"
327+ :class =" {
328+ 'border-destructive focus:border-destructive hover:border-destructive/80 focus:shadow-[0_0_0_2px_rgba(255,38,5,0.06)]':
329+ isInValid,
330+ }"
331+ v-bind =" createComponentProps(slotProps)"
332+ :disabled =" shouldDisabled"
333+ >
334+ <template
335+ v-for =" name in renderContentKey "
336+ :key =" name "
337+ #[name ]=" renderSlotProps "
338+ >
339+ <VbenRenderContent
340+ :content =" customContentRender [name ]"
341+ v-bind =" { ... renderSlotProps , formContext: slotProps } "
342+ />
343+ </template >
344+ <!-- <slot></slot> -->
345+ </component >
346+ </slot >
347+ </FormControl >
348+ </div >
349+
350+ <!-- 自定义后缀 -->
351+ <div v-if =" suffix" class =" ml-1" >
352+ <VbenRenderContent :content =" suffix " />
353+ </div >
354+ <FormDescription v-if =" description " class="ml-1">
355+ <VbenRenderContent :content =" description " />
356+ </FormDescription >
349357 </div >
350358
351- <FormDescription v-if =" description " >
352- <VbenRenderContent :content =" description " />
353- </FormDescription >
354-
355359 <Transition name="slide-up">
356- <FormMessage class="absolute - bottom-[22px] " />
360+ <FormMessage class="absolute bottom-1 " />
357361 </Transition >
358362 </div >
359363 </FormItem >
0 commit comments