Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Vue3 $attr binds on parent element

I have an Input component like this:

<template>
  <div>
    <input v-bind="$attrs"/>
  </div>
</template>

I want to bind input attributes(like autofocus, placeholder, and...) just on the input tag but it also binds on the parent div tag. The div tag is important and I can't ignore this tag in the Input component. what's wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When there's a single root element (like the div in your case), attributes are automatically applied to that element.

You can disable that behavior with inheritAttrs=false:

<script>
export default {
  inheritAttrs: false,
}
</script>

demo

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda