I have a select that gets dynamically filled with the vehiculos_usuarios
information, the array contains objects, whose values are shown in the v-select
.
What can I do to predefine a value in the v-select
and at the same time execute the function @change="vehiculoSeleccionado"
? This function will only be executed when making a change in the select and that is not what I want.
<template>
<v-flex xs12 sm6 d-flex>
<v-select
:items="vehiculos_usuario"
label="Selecciona vehiculo"
item-text="nombre"
item-key="vehiculos_usuario"
item-value="id"
return-object
@change="vehiculoSeleccionado"
></v-select>
</v-flex>
</template>
<script>
export default {
data() {
return {
vehiculos_usuario: [
{
id: "-L_UU2Ca0hEruJ8Yxwt2"
idcategoria: "-LWPTMu1m4WYO1wzJFiv"
nombre: "Mazda 2019 - PP223PRL"
placa: "P223PRL"
},
{
id: "-L_UYxSRD9_1rb02fp5X"
idcategoria: "-LWPRsmK3uBYWGeixA8E"
nombre: "Honda - Moto - CC222RRR"
placa: "C222RRR"
}
]
}
},
methods:{
vehiculoSeleccionado(val){
console.log("Vehiculo Seleccionado");
console.log(val);
}
}
}
</script>
In this way you can see:
Basically I want that when starting the view the select contains a predefined value, from the vehiculos_usuarios
information and it should look like this, at the same time executing the
function vehiculoSeleccionado
Thank you very much.