I'm struggling to pass the id of a clicked button from MovieTable.vue
to the WatchedForm.vue
component. The WatchedForm.vue
component is responsible for updating the data in the database based on the provided id, which corresponds to the Movie_id in the database. I attempted to use props to achieve this, but unfortunately couldn't get it to work. Any assistance would be greatly appreciated as I'm feeling quite frustrated!
App.vue:
<template>
<div class="container p-5">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#movieModal">
Add Movie
</button>
<movie-form @add:movie="addMovie" />
<movie-table
:movies="movies"
@delete:movie="deleteMovie"
@edit:movie="WatchedMovie"
@edit2:movie="unWatchedMovie"
/>
</div>
<watched-form
@edit:movie="watchedMovie"
@edit2:movie="unWatchedMovie"
/>
</template>
MovieTable.vue:
<template>
<div id="movie-table">
<p v-if="movies.length < 1" class="empty-table">No movies</p>
<table v-else>
<thead>
...
</table>
</div>
</template>
And WatchedForm.vue:
<template>
<div id="watched-form">
<div class="modal fade" id="watchedModal" tabindex="-1" aria-labelledby="watchedModalLabel" aria-hidden="true">
...
</div>
</div>
</template>