Skip to content

$emit with multiple arguments loses data with inline listener utilizing $event #5527

@tomsseisums

Description

@tomsseisums

Version

2.2.6

Reproduction link

https://jsfiddle.net/psycketom/50wL7mdz/29927/

Steps to reproduce

  • Component emits with multiple arguments for payload: $emit('event', first, second, arbitrary), as per documentation.
  • Parent listens to the event via inline statement @event="listener($event)".
  • Notice how listener does not get full payload, but only the first value.

What is expected?

Full event payload, either as an array or other means.

What is actually happening?

Only the first value is passed.


I ran into this by creating a list of components with v-for, listening to an event and I had to pass index parameter to the listener: @event="listener(index, $event).

Maybe my use case is meant to be solved differently (bound data attribute?!), if so, I wouldn't mind some guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions