Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

66
Vistas
Vue array in array change index for secod array

I have an array:

[{ title: 'title 1', options: ['a', 'b'] },
{ title: 'title 2', options: ['c', 'd'] },
{ title: 'title 3', options: ['e', 'f'] }]

And I render this array using v-for:

<div v-for="(item, i) in content" :key="item.title">
    <div>
        <div>{{ item.title }}</div>
        <div :class="{'selected-item': i === selectedIndex}">
            {{ item.options[selectedOptionIndex] }}
        </div>
    </div>
</div>

When I change the value of the selectedOptionIndex, it changes for each index (for title 1, title 2 and title 3). I want change option only for e.g title 1. How I can fix it?

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.