Cristiano Magro
2024-12-30 ac100de8d8e0fc85e34cde9aec6262259b12f96c
commit | author | age
2759e2 1 <template>
CM 2     <form @submit.prevent="submitData">
3         <div>
4             <label>Nome:</label>
5             <input type="text" v-model="name" /><br>
6         </div>
7         <div>
8             <label>Phone:</label>
9             <input type="tel" v-model="phone" /><br>
10         </div>
11         <div>
12             <label>Email:</label>
13             <input type="email" v-model="email" /><br>
14         </div>
15         <div>
16             <button>Add new friend</button>
17         </div>
18     </form>
19 </template>
20
21 <script>
22 export default {
23     data() {
24         return {
25             name: "",
26             phone: "",
27             email: "",
28         }
29     },
30     emits: ['add-contact'],
31     methods: {
32         submitData() {
33             this.$emit('add-contact', this.name, this.phone, this.email);
34         }
35     }
36 }
37 </script>
38
39 <style></style>