Skip to content

$listeners migration  #6

Open
Open
@pikax

Description

@pikax

On v3 there's no more $listeners and users might rely on that to handle certain case

// v2
if($listeners['my-event']) {
  // do something
  $listeners['my-event']()
}

In v3 the code can be converted in 2 ways

if($attrs['onMyEvent']) {
  // do something
}
// or 
props: {
  onMyEvent: Function
}
if(props.onMyEvent) {
  // do something
}

I personally think the declaring props is a bit more straight-forward and more explicit

playground

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