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

184
Views
Is it possible to set multiple classes with ternary expressions?

I have a popBox for adding data and when I click the button a window opens in which I enter data while the background is a little bit obscured with opacity.

<div :class="[!popBox ? 'opacity-100' : 'opacity-60']">

This code works perfectly, but I want also to be able to delete data with another popup box saying "do you want delete data" with two buttons.

My question is how can I merge the two below class bindings?

<div :class="[!popBox ? 'opacity-100' : 'opacity-60']">
<div :class="[!popDeleteBox ? 'opacity-100' : 'opacity-60']">
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You just need to update it to

<p :class="[!popBox ? 'opacity-100' : 'opacity-60', !popDeleteBox ? 'opacity-100' : 'opacity-60']"></p>

You could use class bindings, with v-bind:class

<p v-bind:class="{ 'opacity-60': popBox || popDeleteBox, 'opacity-100': !popBox && !popDeleteBox, }"></p>

Or, just as a string

<p :class="`${!popBox ? 'opacity-100' : 'opacity-60'} ${!popDeleteBox ? 'opacity-100' : 'opacity-60'}`"></p>
about 4 years ago · Juan Pablo Isaza 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!