From 498b475805c4383c51ef54bc3a2bc47aa63e895a Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Sat, 28 Dec 2024 22:07:39 +0100 Subject: [PATCH] passaggio delle proprietà come props --- 07 - development setup/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/07 - development setup/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue b/07 - development setup/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue index e32a8d4..d2bf6a1 100644 --- a/07 - development setup/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue +++ b/07 - development setup/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue @@ -1,18 +1,23 @@ <template> <li> - <h2>{{ friend.name }}</h2> + <h2>{{ name }}</h2> <button @click="toggleDetails"> {{ detailsAreVisible ? 'Hide' : 'Show' }} Details </button> <ul v-if="detailsAreVisible"> - <li><strong>Phone:</strong> {{ friend.phone }}</li> - <li><strong>Email:</strong> {{ friend.email }}</li> + <li><strong>Phone:</strong> {{ phoneNumber }}</li> + <li><strong>Email:</strong> {{ emailAddress }}</li> </ul> </li> </template> <script> export default { + props: [ + 'name', + 'phoneNumber', + 'emailAddress', + ], data() { return { detailsAreVisible: false, -- Gitblit v1.8.0