0👍
First, make sure you are using v-bind
(abbreviated as :
) as shown below:
<select
v-model="selectedDistrictIndex"
name="address[district_id]"
id="address[district_id]"
class="form-control"
>
<option value="0" selected disabled>
Choose district
</option>
<option
v-for="district in places[cityIndex].districts"
:value="$index"
>
@{{ district.name }}
</option>
</select>
And use a computed to get the districtId
like this:
computed: {
selectedDistrictId: function () {
return this.places[this.cityIndex].districts[this.selectedDistrictIndex].id;
}
}
- [Vuejs]-Vue – Activate VNode Adjustment
- [Vuejs]-How can I get text selected when category clicked on combobox ? (Vue.JS 2)
Source:stackexchange.com