From 1630a97e508f8fa2c43693eb8adfdd2412004821 Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Mon, 30 Dec 2024 20:14:37 +0100 Subject: [PATCH] delete contact --- 07 - development setup/vue-cli-01-a-new-vue-project/src/App.vue | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/07 - development setup/vue-cli-01-a-new-vue-project/src/App.vue b/07 - development setup/vue-cli-01-a-new-vue-project/src/App.vue index 9859157..bdc3f3f 100644 --- a/07 - development setup/vue-cli-01-a-new-vue-project/src/App.vue +++ b/07 - development setup/vue-cli-01-a-new-vue-project/src/App.vue @@ -12,7 +12,10 @@ :phone-number="friend.phone" :email-address="friend.email" :is-favorite="friend.isFavorite" - @toggle-favorite="toggleFavoriteStatus"></friend-contact> + @toggle-favorite="toggleFavoriteStatus" + @delete="deleteContact" + > + </friend-contact> </ul> </section> </template> @@ -59,7 +62,12 @@ }; this.friends.push(newFriendContact); - } + }, + deleteContact (friendId){ + this.friends = this.friends.filter( + (friend) => friend.id != friendId + ); + }, } }; -- Gitblit v1.8.0