From fb09dca31f9a64ca4287579006014157a3d8156c Mon Sep 17 00:00:00 2001
From: Cristiano Magro <cristiano.magro@vola.it>
Date: Sat, 28 Dec 2024 22:39:21 +0100
Subject: [PATCH] specifica dettagliata dei parametri e validatore custom

---
 07 - development setup/vue-cli-01-a-new-vue-project/src/components/FriendContact.vue |   35 +++++++++++++++++++++++++++++------
 07 - development setup/vue-cli-01-a-new-vue-project/src/App.vue                      |    1 +
 2 files changed, 30 insertions(+), 6 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 7a5c6ce..76cb7d5 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
@@ -8,6 +8,7 @@
       name="Manuel Lorenz" 
       phone-number="123" 
       email-address="cicio@ciccio.it"
+      is-favorite="1"
       ></friend-contact>
       <friend-contact
       name="Jeany Torpedo" 
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 c10fcf8..e01781a 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
@@ -17,12 +17,35 @@
 
 <script>
 export default {
-    props: [
-        'name',
-        'phoneNumber',
-        'emailAddress',
-        'isFavorite'
-    ],
+    // props: [
+    //     'name',
+    //     'phoneNumber',
+    //     'emailAddress',
+    //     'isFavorite'
+    // ],
+    props: {
+        name: {
+            title: String,
+            required: true
+        },
+        phoneNumber: {
+            title: String,
+            required: true
+        },
+        emailAddress: {
+            title: String,
+            required: true
+        },
+        isFavorite: {
+            title: String,
+            required: false,
+            default: '0',
+            validator: function (value) {
+                return value === '1' || value === '0';
+            }
+        },
+    },
+
     data() {
         return {
             detailsAreVisible: false,

--
Gitblit v1.8.0