I'm working with 3 components: TaskList, TaskItem, and TaskForm.
Within the TaskList component, there is a loop that renders all the data in TaskItem. Each TaskItem has an edit button meant to open a TaskForm modal (using bootstrap) displaying the specific task data.
TaskForm.vue
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" id="formModal">
// Modal content here
</div>
TaskList.vue
<div class="container">
// TaskItem loop
</div>
TaskItem.vue
<div class="row align-items-center p-2 border rounded mt-2">
// Task details
<button class="btn btn-primary" @click="showForm = !showForm" data-bs-toggle="modal" data-bs-target="#formModal">
<i class="bi bi-pencil-square"></i>
</button>
</div>
<TaskForm v-if="showForm" :task="props.task"/>
However, I've encountered an issue where each modal displays the first task's name instead of the selected one.
While this approach works for now, I believe there might be a better way to achieve my goal (editing a list item). If anyone has a more efficient solution, I would love to hear it.