The next element is a single <select> element with multiple <option> elements as follows:
// src/components/basic.vue
<select v-model="form.favourite">
<option disabled value="">Please select one</option>
<option value="On the Origin of Species">On the Origin of
Species</option>
<option value="A Brief History of Time">A Brief History of Time</option>
<option value="The Selfish Gene">The Selfish Gene</option>
</select>
export default {
data () {
return {
form: { favourite: null }
}
},
methods:{
checkForm (e) {
this.errors = []
if (!this.form.favourite) {
this.errors.push('Favourite required')
}
}
}
}
And the last one is multiple <select> elements with multiple <option> elements that are bound to the same Array, that is, favourites: []:
// src/components...