diff --git a/vue-cli-01-a-new-vue-project/src/App.vue b/vue-cli-01-a-new-vue-project/src/App.vue index 6cee210..09f6a16 100644 --- a/vue-cli-01-a-new-vue-project/src/App.vue +++ b/vue-cli-01-a-new-vue-project/src/App.vue @@ -12,6 +12,7 @@ :phone-number="friend.phone" :is-favorite="friend.isFavorite" @toggle-favorite="togggleFavoriteStatus" + @delete-friend="deleteFriend" > @@ -49,6 +50,10 @@ export default { addContact(NewFriend) { this.friends.push(NewFriend); }, + deleteFriend(id) { + //if the ID matches drop the friend + this.friends = this.friends.filter((friend) => friend.id !== id); + }, }, }; diff --git a/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue b/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue index 8a3ba17..04d770a 100644 --- a/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue +++ b/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue @@ -7,6 +7,7 @@