I am aware that the selected attribute does not function when utilizing v-model
. However, I need to use v-model
to retrieve the selected user and incorporate it into my firebase. Therefore, here is how my HTML is structured:
<select v-model="medespeler1" class="inputbox rounded" required>
<option v-for="(option, i) in medespelers" :key="i" :selected="selected">{{ medespelers[i] }}</option>
</select>
To access all the medespelers
stored in the database along with the medespeler1
value, I have included this in the data property:
data: function() {
return {
medespelers:[],
medespeler1: '',
}
},
Within Firebase, I save all the medespelers
in an array and pass it to the data property. Since I must send the medespeler1
value as well, using :selected
is not feasible. Where should I begin to ensure that both the medespeler1
value is stored and there is a selected item within the array?