I have a form and would like the field (which is a select) to return (selected) the previously marked value.
Ex: If my selected is empty, select
will show the values normally (1, 2, 3, 4). If it has value, my select
will show all values, but will come with the value 2 selected already.
<select v-model="item" style="height: 40px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
data(){
return{
item: ''
}
},
mounted(){
this.api()
},
methods: {
api(){
axios.get(url)
.then(response => {
this.item = response.data.select
}
}
}