Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda