Skip to content

Multiple events in single v-on similar to v-bind="object" #5578

@crswll

Description

@crswll

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 and v-on work similarly.

What does the proposed API look like?

v-on="{ 'click.shift': methodOne, 'keyup.left': methodTwo, 'keyup.right.stop': methodTwo }"

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/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions