From ac100de8d8e0fc85e34cde9aec6262259b12f96c Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Mon, 30 Dec 2024 21:53:48 +0100 Subject: [PATCH] style scoped locali --- 08 - component communication/cmp-communication-assignment-problem/src/components/UserData.vue | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/08 - component communication/cmp-communication-assignment-problem/src/components/UserData.vue b/08 - component communication/cmp-communication-assignment-problem/src/components/UserData.vue new file mode 100644 index 0000000..d272af8 --- /dev/null +++ b/08 - component communication/cmp-communication-assignment-problem/src/components/UserData.vue @@ -0,0 +1,38 @@ +<template> + <form @submit.prevent="submitData"> + <div> + <label>Utente: </label> + <input type="text" v-model="username"> + </div> + <div> + <label>Eta: </label> + <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