commit | author | age
|
2eca01
|
1 |
<template> |
CM |
2 |
<li> |
|
3 |
<h2>{{ friend.name }}</h2> |
|
4 |
<button @click="toggleDetails">Show Details</button> |
|
5 |
<ul v-if="detailsAreVisible"> |
|
6 |
<li> |
|
7 |
<strong>Phone:</strong> |
|
8 |
{{ friend.phone }} |
|
9 |
</li> |
|
10 |
<li> |
|
11 |
<strong>Email:</strong> |
|
12 |
{{ friend.email }} |
|
13 |
</li> |
|
14 |
</ul> |
|
15 |
</li> |
|
16 |
</template> |
|
17 |
|
|
18 |
<script> |
|
19 |
export default { |
|
20 |
data() { |
|
21 |
return { |
|
22 |
detailsAreVisible: false, |
|
23 |
friend: { |
|
24 |
id: "manuel", |
|
25 |
name: "Manuel Lorenz", |
|
26 |
phone: "0123 45678 90", |
|
27 |
email: "manuel@localhost.com", |
|
28 |
}, |
|
29 |
}; |
|
30 |
}, |
|
31 |
methods: { |
|
32 |
toggleDetails() { |
|
33 |
this.detailsAreVisible = !this.detailsAreVisible; |
|
34 |
} |
|
35 |
} |
|
36 |
}; |
|
37 |
</script> |