Cristiano Magro
2024-12-30 ac100de8d8e0fc85e34cde9aec6262259b12f96c
commit | author | age
c65c4f 1 <template>
CM 2   <section>
3     <form @submit.prevent="submitData">
4       <input type="text" placeholder="Your name" v-model="enteredName" />
5       <input type="text" placeholder="Your age" v-model="enteredAge" />
6       <button>Set User Data</button>
7     </form>
8   </section>
9 </template>
10
11 <script>
12 export default {
13   emits: ['set-data'],
14   data() {
15     return {
16       enteredName: "",
17       enteredAge: "",
18     };
19   },
20   methods: {
21     submitData() {
22       this.$emit('set-data', this.enteredName, this.enteredAge);
23     }
24   }
25 };
26 </script>