Working with select in Vue
Working with select is done in a similar way - the v-model attribute is attached to the tag, and the data object property is bound to it. The text of the selected option tag will be placed in this property.
The following code shows an example of how a drop-down list works:
data() {
return {
selected: 'value1', // default value
}
}
<template>
<select v-model="selected">
<option>value1</option>
<option>value2</option>
<option>value3</option>
</select>
<p>{{ selected }}</p>
</template>
Ask the user with select what city they live in. Make the selected city appear in a paragraph.