Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49082

Vue Ion Toggle change event is wrong

$
0
0

Found what I would believe to be a bug in Ion Toggle. Imo, Ion Toggle should behave directly as a nicer UI version of a checkbox. Yet, presumably due to it being wrapped in a button, it’s change event fires before v-model is updated.

Take this side by side example:

<ion-toggle v-model="profile.isNotifyByTextMessage" @ionChange="saveProfile"/>

<input type="checkbox" v-model="profile.isNotifyByTextMessage" @change="saveProfile"/>

In my opinion, saveProfile should have access to profile in the state set here. In other words, if the checkbox is checked, when saveProfile runs, profile.isNotifyByTextMessage should be true.

It is when using checkbox, it is not when using ion-toggle. When the ion-toggle is switched to true, I log out isNotifyByTextMessage: false. But when the checkbox is set to true, I log out isNotifyByTextMessage: true.

I’m aware that it’s still an event so i could do like event.target.value in ionChange, but…that sort of defeats the purpose of v-model.

Is this a bug? It certainly seems like it to me.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49082

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>