-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v-on events are not working #13
Comments
@dmitriymarley |
[Vue warn]: Error in event handler for "input": "ReferenceError: array is not defined" found in ---> at node_modules\vue-switches\src\switches.vue help? I just wanna add an event listener |
@Dulan666 ensure that your "array" property which could possibly be in data or computed actually exists.. read the error message: |
@dkrasov Using emitters is needed because this is a component that must announce that an action is happening to other components. It's pretty easy to then "listen" to this data emitted and then perform whatever method or action you need. You can see example and setup here: https://stackoverflow.com/questions/40300634/emit-an-event-from-child-to-parent-in-vue-js-es6-syntax |
how can i sent the current status and also an identifier?
for example? |
@antonioreyna you can use the is that what you are looking for? |
@dkrasov yes! now i get my id and the value, but then the switch does not animate to the true or false value it keeps on OFF |
this is my switch code:
then on my method just:
|
use v-model instead of v-value, otherwise you need to update it by yourself |
the thing is that my v-model in this case is a list of dates so if the date is null then the switch is off and if it is a date the switch is on, if i set it v-model it changes my date to true or false, can you tell me how do i update it manually then in my method? thank you so much for your help |
setRealizado: function(id, event) {
console.log('id', id);
console.log('val', event);
this.servicio.realizado = event
} this in case event is the boolean switch value, to explain it a little bit, the v-value determine the "state" of the switch same as a normal |
got it! i had to create a new array for my switches v-model but now its working thank you so much! |
ningún problema amigo |
Hi! |
Hi!
I'm using your component, and I've noticed that
v-on
events (nor@change
) are not working with your component, so I'm using watchers for my properties bound to switches.The events support would be great improvement IMO.
The text was updated successfully, but these errors were encountered: