Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

67
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.