pedi2/resources/js/components/RegionSelect.vue

36 lines
846 B
Vue
Raw Normal View History

2022-05-25 19:03:29 -03:00
<template>
<div class="block">
<div class="field">
<label class="label">Seleccioná tu región</label>
<div class="control">
<div class="select">
<select @change="onRegionSelected" v-model="region">
<option :disabled="isDefaultDisabled==1" value=null>Seleccionar</option>
<option v-for="region in regiones" v-text="region" :name="region"></option>
</select>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
regiones: [],
isDefaultDisabled: 0,
region: null
}
},
mounted() {
axios.get("/api/regiones").then(response => this.regiones = response.data);
},
methods: {
onRegionSelected() {
this.isDefaultDisabled = 1;
Event.$emit("region-seleccionada",this.region);
}
}
}
</script>