Im begginer in VueJs so i have this problem
Here my code
<md-select placeholder="Seleccione Lote" v-model="selectedLote" name="lotes" id="lotes">
<md-option v-for="lote of lotes" value="lote.value">{{lote.text}}</md-option>
</md-select>
Then i have my array
data: () => ({
lotes: [],
selectedLote : null
})
Then i populate this array using this (this.products is an array populated from an api request)
mounted(){
this.fillLotesArray();
},
methods:{
fillLotesArray(){
for(let product of this.products){
if(this.lotes.findIndex(lote => lote.value === product._source.Lote) === -1){
this.lotes.push({value:product._source.Lote, text:product._source.Lote});
}
}
}
}
Using console.logs i can see the array is filled correctly but the options dont