示例
下拉列表
<div class="form-control">
<label for="referrer">How did you hear about us?</label>
<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>
</select>
</div>
<script>
export default {
data() {
return {
userName: '',
userAge: null,
referrer: 'wom',
};
},
methods: {
submitData() {
console.log("UserName: " + this.userName);
this.userName = '';
console.log("UserAge: ");
console.log(this.userAge + 5);
console.log(this.$refs.ageInput.value + 5);
console.log(31);
this.userAge = null;
console.log("Referrer: " + this.referrer);
this.referrer = 'wom';
}
}
};
</script>