How to get additional data-type attribute of ion-select-option in @ionChange event?
I want to set formData.type base on which option is currently selected. This is the solution that works for vue select but ion-select-option doesnt have $event.target.options nor $event.target.selectedIndex.
Please help, thank you!
<ion-select v-model="formData.customer_id"
@ionChange="formData.type = $event.target.options[$event.target.selectedIndex].getAttribute('data-type')"
label="Výber odberateľa"
label-placement="floating" fill="outline" interface="popover">
<ion-select-option v-for="value in locations"
:key="value.id"
:value="value.id"
:data-value="value.id"
data-type="transport">{{ value.description }}</ion-select-option>
<ion-select-option v-for="value in customers"
:key="value.id"
:value="value.id"
:data-value="value.id"
data-type="sale">{{ value.company_name }}</ion-select-option>
</ion-select>
{{ formData.type }}