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

403
Views
How to Vue v-if equal or contains

Can anyone please show me how to do this, I have a image with alt than contains alt="#color_blue" or alt="#color_orange", I call this data with Liquid as {{ media.alt }}

that I want to do is if the 'current_variant.alt' == {{ media.alt }} return true and also if the 'current_variant.alt' contain '#' return too true as well.

<div v-if="current_variant.alt == '{{ media.alt }}' && current_variant.alt == '#'">

</div>

I don't know how to let current_variant.alt check if the {{ media.alt }} contains #

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can use the string.includes method to check if a string contains a particular character.


If you want to check if current_variant.alt equals media.alt:

current_variant.alt == '{{ media.alt }}'

If you want to check if current_variant.alt contains '#':

current_variant.alt.includes('#')

If you want to check if media.alt contains '#':

'{{ media.alt }}'.includes('#')
over 4 years ago · Santiago Trujillo Report

0

To check if current_variant.alt contain #, use Javascript "includes" => current_variant.alt.includes('#')

<div v-if="current_variant.alt == media.alt && current_variant.alt.includes('#')">    
</div>
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!