From 67121916c668a07d15fae8be1bd7b1bd5815c323 Mon Sep 17 00:00:00 2001 From: SonTT19 Date: Tue, 10 Dec 2024 15:54:24 +0700 Subject: [PATCH] fix(VField): fix regression hide label with single-line --- packages/vuetify/src/components/VField/VField.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/vuetify/src/components/VField/VField.tsx b/packages/vuetify/src/components/VField/VField.tsx index 6ad56c5efdb..20b3975afb6 100644 --- a/packages/vuetify/src/components/VField/VField.tsx +++ b/packages/vuetify/src/components/VField/VField.tsx @@ -137,7 +137,8 @@ export const VField = genericComponent( const { rtlClasses } = useRtl() const isActive = computed(() => props.dirty || props.active) - const hasLabel = computed(() => !props.singleLine && !!(props.label || slots.label)) + const hasLabel = computed(() => !!(props.label || slots.label)) + const hasFloatingLabel = computed(() => !props.singleLine && hasLabel.value) const uid = getUid() const id = computed(() => props.id || `input-${uid}`) @@ -156,7 +157,7 @@ export const VField = genericComponent( })) watch(isActive, val => { - if (hasLabel.value) { + if (hasFloatingLabel.value) { const el: HTMLElement = labelRef.value!.$el const targetEl: HTMLElement = floatingLabelRef.value!.$el @@ -290,7 +291,7 @@ export const VField = genericComponent( )}
- {['filled', 'solo', 'solo-inverted', 'solo-filled'].includes(props.variant) && hasLabel.value && ( + {['filled', 'solo', 'solo-inverted', 'solo-filled'].includes(props.variant) && hasFloatingLabel.value && ( ( <>
- { hasLabel.value && ( + { hasFloatingLabel.value && (
{ label() } @@ -394,7 +395,7 @@ export const VField = genericComponent( )} - { isPlainOrUnderlined.value && hasLabel.value && ( + { isPlainOrUnderlined.value && hasFloatingLabel.value && ( { label() }