From ff5308ea297afc7cfe89049f58842a2a3a9c94cf Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Mon, 30 Dec 2024 20:14:37 +0100 Subject: [PATCH] esercizio step 3 --- 07 - development setup/cmp-communication-assignment-problem/src/components/UserData.vue | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) diff --git a/07 - development setup/cmp-communication-assignment-problem/src/components/UserData.vue b/07 - development setup/cmp-communication-assignment-problem/src/components/UserData.vue index 7f9d319..8d16db1 100644 --- a/07 - development setup/cmp-communication-assignment-problem/src/components/UserData.vue +++ b/07 - development setup/cmp-communication-assignment-problem/src/components/UserData.vue @@ -1,16 +1,39 @@ <template> + <form @submit.prevent="submitData"> <div> <label>Utente: </label> - <input type="text"> + <input type="text" v-model="username"> </div> <div> <label>Eta: </label> - <input type="text"> + <input type="text" v-model="age"> </div> + <div> + <button>Update</button> + </div> +</form> </template> <script> export default { + data(){ + return { + username: "", + age: "", + } + }, + emits: ['update-user'], + methods:{ + submitData() { + if(this.username !== "" && this.age !== ""){ + + this.$emit('update-user', this.username, this.age); + } else { + alert("insert data") + } + + } + } } </script> \ No newline at end of file -- Gitblit v1.8.0