Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!