| | |
| | | </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> |
| | |
| | | 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; |
| | | } |