1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| <template>
| <div>
| <active-user :username="user.name" :userage="user.age"></active-user>
| <user-data @set-data="setUserData"></user-data>
| </div>
| </template>
|
| <script>
| export default {
| data() {
| return {
| user: {
| name: "Max Schwarzmüller",
| age: 31,
| },
| };
| },
| methods: {
| setUserData(name, age) {
| this.user = {
| name: name,
| age: +age
| };
| }
| }
| };
| </script>
|
|
| <style>
| html {
| font-family: sans-serif;
| }
|
| section {
| margin: 2rem auto;
| max-width: 40rem;
| border-radius: 12px;
| border: 1px solid #ccc;
| padding: 1rem;
| }
| </style>
|
|