From 9f20397f5fa48aa2ba0b48f47ebc3c853dfd1137 Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Wed, 08 Jan 2025 10:48:49 +0100 Subject: [PATCH] v-model su dropdown --- 11 - Forms/xno-forms-01-starting-setup/src/components/TheForm.vue | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 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 b8a892e..18cbc67 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,11 +6,11 @@ </div> <div class="form-control"> <label for="age">Your Age (Years)</label> - <input id="age" name="age" type="number" v-model="userAge" ref="inputAge"/> + <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> - <select id="referrer" name="referrer"> + <select id="referrer" name="referrer" v-model="referrer"> <option value="google">Google</option> <option value="wom">Word of mouth</option> <option value="newspaper">Newspaper</option> @@ -58,16 +58,20 @@ return { userName: '', userAge: null, + referrer: 'wom', } }, methods: { submitForm() { 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); + console.log('User age: '); + console.log(this.userAge); //number + console.log(this.$refs.inputAge.value); //string + console.log(18); + + console.log('referrer: ' + this.referrer); + this.referrer = 'wom'; this.userAge = null; } -- Gitblit v1.8.0