-
-
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
Multiple events in single v-on similar to v-bind="object" #5578
Comments
@crswll, that means that we need to parse all event modifiers in the |
I don't know enough about the Vue internals to answer that well. I guess attempting this feature on my own would be a good way to figure it out. |
I think it's too complicated, do we also need to consider custom events? |
IMO if you do this it should be a separate directive (like |
I think this could be a good fit (and avoid any rewrites) if we followed @wostex's suggestion. Although, a This could open the door for passing around event names+handlers, which would shortcut the (sometimes) repetitive template assignments. |
@lukeed, I still think this should not be a part of Vue, it should be a separate directive that you can use. |
I not opposed to that idea either 👍 |
the modifier has been parsed when template compiling |
This is partially implemented in 11614d6 - however, this syntax is introduced primarily for making it easier to proxy events in components. Modifiers for this syntax introduce too much runtime complexity and is not supported. |
So how do I bind I even tried Tried the only thing I could do to manage it to work was to do manually ;-;
|
Would be great if we could apply modifiers too. |
any update on this ? |
What problem does this feature solve?
It could make binding a bunch of events to an element more clear. It would also make
v-bind
andv-on
work similarly.What does the proposed API look like?
This way we can create a computed list that returns a hash if there's too many event listeners / repetitive events.
I can get something close with a directive but without the modifiers it's not nearly as useful. It also doesn't remove the events but it was a quick attempt.
https://jsfiddle.net/crswll/2fL6gtbg/4/
The text was updated successfully, but these errors were encountered: