Cristiano Magro
2024-12-28 498b475805c4383c51ef54bc3a2bc47aa63e895a
commit | author | age
f31b9e 1 <template>
CM 2     <li>
498b47 3         <h2>{{ name }}</h2>
f31b9e 4         <button @click="toggleDetails">
CM 5             {{ detailsAreVisible ? 'Hide' : 'Show' }} Details
6         </button>
7         <ul v-if="detailsAreVisible">
498b47 8             <li><strong>Phone:</strong> {{ phoneNumber }}</li>
CM 9             <li><strong>Email:</strong> {{ emailAddress }}</li>
f31b9e 10         </ul>
CM 11     </li>
12 </template>
13
14 <script>
15 export default {
498b47 16     props: [
CM 17         'name',
18         'phoneNumber',
19         'emailAddress',
20     ],
f31b9e 21     data() {
CM 22         return {
23             detailsAreVisible: false,
24             friend: {
25                 id: "manuel",
26                 name: "Manuel Lorenz",
27                 phone: "01234 5678 991",
28                 email: "manuel@localhost.com",
29             }
30         }
31     },
32     methods: {
33         toggleDetails() {
34             this.detailsAreVisible = !this.detailsAreVisible;
35         },
36     },
37 };
38 </script>