From 79dfa2cf60feebd3e205d2992167b61171d7a47d Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Wed, 08 Jan 2025 10:41:21 +0100 Subject: [PATCH] v-model su number --- 11 - Forms/xno-forms-01-starting-setup/src/components/TheForm.vue | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/11 - Forms/xno-forms-01-starting-setup/src/components/TheForm.vue b/11 - Forms/xno-forms-01-starting-setup/src/components/TheForm.vue index be9feed..b8a892e 100644 --- a/11 - Forms/xno-forms-01-starting-setup/src/components/TheForm.vue +++ b/11 - Forms/xno-forms-01-starting-setup/src/components/TheForm.vue @@ -6,7 +6,7 @@ </div> <div class="form-control"> <label for="age">Your Age (Years)</label> - <input id="age" name="age" type="number" /> + <input id="age" name="age" type="number" v-model="userAge" ref="inputAge"/> </div> <div class="form-control"> <label for="referrer">How did you hear about us?</label> @@ -57,13 +57,20 @@ data() { return { userName: '', + userAge: null, } }, methods: { submitForm() { - console.log('Username: ' + this.userName ); + console.log('Username: ' + this.userName); this.userName = ''; - } + console.log('User age: '); // + this.userName); + console.log(this.userAge); + console.log(this.$refs.inputAge.value); + console.log(18); // + this.userName); + + this.userAge = null; + } } } -- Gitblit v1.8.0