<select class="form-control" v-model="month_selected">
<option v-for="month in months" :value="month.value">${ month.label }</option>
</select>
data: {
month_selected: '',
months: [
{value: '1', label: 'Janeiro'},
{value: '2', label: 'Fevereiro'},
{value: '3', label: 'Março'},
{value: '4', label: 'Abril'},
{value: '5', label: 'Maio'},
{value: '6', label: 'Junho'},
{value: '7', label: 'Julho'},
{value: '8', label: 'Agosto'},
{value: '9', label: 'Setembro'},
{value: '10', label: 'Outubro'},
{value: '11', label: 'Novembro'},
{value: '12', label: 'Dezembro'},
]
},
mounted() {
// Pega mês atual
const date = new Date();
this.month_selected = date.getMonth() + 1
}
Last active
March 25, 2019 00:31
-
-
Save rg3915/4582051bd59164444bdbaa3d1ab59b93 to your computer and use it in GitHub Desktop.
VueJS Tips select option month default value mês
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment