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

175
Views
add condition in name option select with loop array

Hello I would like to put a condition on the name of the option if the object sku.attributes is empty the name is same product otherwise it displays the color and size

skusListProduct = [{attributes:{size:'m', color: 'black'}}] // ex array
            <select
              v-model="skuList"
              @change="productChoice"
            >
              <option
                v-for="sku in skusListProduct"
                :key="sku.id"
                :value="sku.id"
              >
                <span v-if="sku.attributes && sku.attributes.length > 0">
                  {{ sku.attributes.color }} {{ sku.attributes.size }}
                </span>
                <span v-else>
                  same product
                </span>
              </option>
            </select>

I'm do that but is doesn't work

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm resolve my answer check if keys sku.attributes is exist

sku.attributes && Object.keys(sku.attributes).length > 0

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!