I am stuck in a critical moment, while using vue with laravel. i use a select2 and show my selected option with its value.when i am going for form submission , selected option won't return its value first time, but in second time if i going to select my option again , it work. i need help
Here is my laravel Blade Template:
<select name="income[]" id="" v-model="ledger_cash_in.income" class="js-example-basic-single">
<option value="">...</option>
@foreach ($ledger_category as $cat)
<optgroup label="{{ $cat->inv_ledg_cat_category_name }}">
@foreach ($cat->getLedgers as $ledg)
<option value="{{ $ledg->inv_ledg_id }}">{{ $ledg->inv_ledg_ledger_name }}</option>
@endforeach
</optgroup>
@endforeach
</select>
<button type="button" class="btn btn-success btn-xs" @click="addNewRow()">
<i class="fa fa-plus"></i>
</button>
And this my Vue Code
var app = new Vue({
el: "#ledger",
data: {
ledger_cash_ins: [],
},
methods:{
addNewRow() {
this.ledger_cash_ins.push({
income: '',
});
}
},
beforeMount(){
this.addNewRow();
},
});