euvl/vue-js-toggle-button

Original value with change event

mikeda37 opened this issue · 5 comments

Is it possible to pass an original value with change events and keep a default event object?
With this way, @change="onChangeEvent(id)", I can't get default 'value'.

euvl commented

I don't think it is possible.

So if I wanna pass index and status value, the code is going to be like this?
<toggle-button v-model="status" @change="onChangeEvent(index, status)"/>

euvl commented

Pass it where? I do not understand what you are trying to do but if you want to use an event from the @change you can get by using $event: @change="myfunctions($event)".

I do not know what index is and why you need to pass status in onChangeEvent (you already have it your model, you can just use this.status within onChangeEvent).

Check out these docs, they might be useful:
https://vuejs.org/v2/guide/events.html#Methods-in-Inline-Handlers
https://vuejs.org/v2/guide/components.html#Using-v-model-on-Components

Sorry I didn't make clear.
I need to use both an index of v-for and toggle status but I didn't know how to pass them.
The answer I wanted is @change="myfunctions(index, $event)".

Thanks for the docs refferences. I need to study the basic of Vue.js more.
Sorry for bothering you and thanks for your kinds!

euvl commented

Great, happy to help 👍 Thanks for using plugin!