processo di cancellazione di una resource
presenta un problema
| | |
| | | <base-card> |
| | | <header> |
| | | <h3>{{ title }}</h3> |
| | | <base-button mode="flat">Delete</base-button> |
| | | <base-button mode="flat" @click="deleteResource(id)" |
| | | >Delete</base-button |
| | | > |
| | | </header> |
| | | <p>{{ description }}</p> |
| | | <nav> |
| | |
| | | |
| | | <script> |
| | | export default { |
| | | props: ['title', 'description', 'link'], |
| | | props: ['id', 'title', 'description', 'link'], |
| | | inject: ['deleteResource'], |
| | | }; |
| | | </script> |
| | | |
| | |
| | | <learning-resource |
| | | v-for="res in resources" |
| | | :key="res.id" |
| | | :id="res.id" |
| | | :title="res.title" |
| | | :description="res.description" |
| | | :link="res.link" |
| | |
| | | return { |
| | | resources: this.storedResouces, |
| | | addResource: this.addResource, |
| | | deleteResource: this.removeResource, |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | this.storedResouces.unshift(newResource); |
| | | this.selectedTab = 'stored-resources'; |
| | | }, |
| | | removeResource(resId) { |
| | | this.storedResouces = this.storedResouces.filter( |
| | | (res) => res.id !== resId |
| | | ); |
| | | console.log(this.storedResouces.length); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |