Skip to content
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

Component is emiting multiple input events #1035

Open
JoelPintoRibeiro opened this issue Feb 22, 2021 · 0 comments
Open

Component is emiting multiple input events #1035

JoelPintoRibeiro opened this issue Feb 22, 2021 · 0 comments

Comments

@JoelPintoRibeiro
Copy link

JoelPintoRibeiro commented Feb 22, 2021

Error:
When having two masked-input in the same component and one of them emits a value all of the component emits a input value

Reproduction sandbox here : https://codesandbox.io/s/dreamy-shadow-p8df5?file=/src/App.vue

Look the console when you change the value of the first input or the second its also emit a value for ALL masked-input components.

I debugged it and its caused by the "mask" watcher here :


watch: {
mask(newMask, oldMask) {
// Check if the mask has changed (Vue cannot detect whether an array has changed)
if (this.mask !== oldMask) {
this.bind()
}
},

its tries to compare the arrays and they are always different so it call "this.bind" that triggers a useless "input" event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant