How do I load a select in vue.js before it's visible. So right now I've this:
methods: {
getTypes () {
TypeService.showAll(1)
.then(({ data }) => ({
types: data.types
}));
}
}
Here I receive the types that will be visible in the select like this:
<select v-model="ride.type" class="Radio__admin">
<option disabled selected>Type?</option>
<option v-for="type in types" v-bind:value="type.id">
</select>
But when I say:
init () {
this.getTypes();
}
I get the error:
main.js:16526 Uncaught ReferenceError: getTypes is not defined
How should I do this?