From c236e653e52b57e6cc953fb4aa9d092db7ea7fbc Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 27 Jan 2021 12:53:30 +0100 Subject: [PATCH] add a more extended emits definition --- .../src/components/FriendContact.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 bd512f1..8a3ba17 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 @@ -36,7 +36,16 @@ export default { default: false, }, }, - emits: ["toggle-favorite"], + emits: { + "toggle-favorite": function(id) { + if (id) { + return true; + } else { + console.warn("ID is missing!"); + return false; + } + }, + }, data() { return { detailsAreVisible: false,