| | |
| | | :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> |
| | |
| | | }; |
| | | |
| | | this.friends.push(newFriendContact); |
| | | } |
| | | }, |
| | | deleteContact (friendId){ |
| | | this.friends = this.friends.filter( |
| | | (friend) => friend.id != friendId |
| | | ); |
| | | }, |
| | | |
| | | } |
| | | }; |
| | |
| | | <li><strong>Phone:</strong> {{ phoneNumber }}</li> |
| | | <li><strong>Email:</strong> {{ emailAddress }}</li> |
| | | </ul> |
| | | <button @click="$emit('delete', id)">Delete</button> |
| | | </li> |
| | | </template> |
| | | |
| | |
| | | // } |
| | | }, |
| | | }, |
| | | emits:['toggle-favorite'], |
| | | emits:['toggle-favorite', 'delete'], |
| | | // emits: { |
| | | // 'toggle-favorite': function (id) { |
| | | // if (id) { |
| | |
| | | toggleFavorite() { |
| | | this.$emit('toggle-favorite', this.id); |
| | | }, |
| | | // deleteFriend(){ |
| | | // this.$emit('delete', this.id); |
| | | // } |
| | | }, |
| | | }; |
| | | </script> |