Skip to content

Commit

Permalink
fix(VField): fix regression hide label with single-line
Browse files Browse the repository at this point in the history
  • Loading branch information
SonTT19 committed Dec 10, 2024
1 parent 4a628a3 commit 6712191
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/vuetify/src/components/VField/VField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export const VField = genericComponent<new <T>(
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}`)
Expand All @@ -156,7 +157,7 @@ export const VField = genericComponent<new <T>(
}))

watch(isActive, val => {
if (hasLabel.value) {
if (hasFloatingLabel.value) {
const el: HTMLElement = labelRef.value!.$el
const targetEl: HTMLElement = floatingLabelRef.value!.$el

Expand Down Expand Up @@ -290,7 +291,7 @@ export const VField = genericComponent<new <T>(
)}

<div class="v-field__field" data-no-activator="">
{['filled', 'solo', 'solo-inverted', 'solo-filled'].includes(props.variant) && hasLabel.value && (
{['filled', 'solo', 'solo-inverted', 'solo-filled'].includes(props.variant) && hasFloatingLabel.value && (
<VFieldLabel
key="floating-label"
ref={ floatingLabelRef }
Expand Down Expand Up @@ -382,7 +383,7 @@ export const VField = genericComponent<new <T>(
<>
<div class="v-field__outline__start" />

{ hasLabel.value && (
{ hasFloatingLabel.value && (
<div class="v-field__outline__notch">
<VFieldLabel ref={ floatingLabelRef } floating for={ id.value }>
{ label() }
Expand All @@ -394,7 +395,7 @@ export const VField = genericComponent<new <T>(
</>
)}

{ isPlainOrUnderlined.value && hasLabel.value && (
{ isPlainOrUnderlined.value && hasFloatingLabel.value && (
<VFieldLabel ref={ floatingLabelRef } floating for={ id.value }>
{ label() }
</VFieldLabel>
Expand Down

0 comments on commit 6712191

Please sign in to comment.