-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
bound event with once gets reused in v-if/else condition #8032
Comments
As a note, you should not use both, v-on and onclick (Vue cannot detect the later) |
Noted. The onclick attribute is just to test the issue. My use case is, the link with v-on:click.once is supposed to call to the server, while the other one supposed to redirect to another page with no JS involved. But I was having an issue because when I click the link to redirect, it is actually doing a call to the server. Thanks for the help. It works by adding "key" attribute. |
If you want to prevent the default action of an event, please use |
It seems that |
I'm not a English native speaker, I'll do my best to describe it. The reason for this problem is element reuse, |
Version
2.5.16
Reproduction link
https://codepen.io/katedo17/pen/rdXMbp
Steps to reproduce
Enter "3" in the input field, and click the link "Test Btn 2".
What is expected?
It should only trigger the on click event that was configured for the "Test Btn 2".
What is actually happening?
It triggers the function binded to "Test Btn 1" and then trigger the "Test Btn 2".
This only happens when I use v-if in the parent element of the link. But if I use v-show, it doesn't have the issue.
The text was updated successfully, but these errors were encountered: