I'm developing a custom DownloadButton component in VueJS that features an animation when clicked and stops animating once the download is complete. The DownloadButton will be utilized within a table where it's replicated multiple times. I intend to keep the download functionality within the parent component. However, the issue arises when changing the loading state affects all instances of the DownloadButton rather than just the one that was clicked.
Parent Component:
<DownloadButton @click.native="download" :loading="loading"></DownloadButton>
<DownloadButton @click.native="download" :loading="loading"></DownloadButton>
<DownloadButton @click.native="download" :loading="loading"></DownloadButton>
methods: {
download() {
this.loading = true
// waiting for the download process to complete...
this.loading = false
}
}