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

275
Vistas
Vue - Problem when passing props with a colon into the component

I want to pass TailwindCSS pseudo-classes to a child component. However, I get an error message (Parsing error. Unexpected token :...).

Here is my code:

<cartImage :images="p.images" :classNames="hover:grow hover:shadow-lg" />
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

It seems you just need to pass a static value to the classNames prop. So you only need to remove the colon like this:

<cartImage :images="p.images" classNames="hover:grow hover:shadow-lg" />
over 4 years ago · Santiago Trujillo Denunciar

0

When you do this :

:classNames="hover:grow hover:shadow-lg"

it will think of hover:grow hover:shadow-lg as a valid statement or variable - which will fail at this point.


If you want to pass a String you have 2 Options :

Either with a static prop

classNames="hover:grow hover:shadow-lg"

Or you wrap the input inside 2 single quotes '...' :

:classNames="'hover:grow hover:shadow-lg'"
over 4 years ago · Santiago Trujillo 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