Skip to content

vm.$off not working when passing an array as first argument #6945

@cheng-kang

Description

@cheng-kang

Version

2.5.2

Reproduction link

https://jsfiddle.net/CHENGKANG/4owjvLLk/5/

Steps to reproduce

  1. Add multiple custom event listeners
this.$on(['event1', 'event2'], () => {
    console.log('This is callback.')
})
  1. Try to remove them with vm.$off
this.$off(['event1', 'event2'])
  1. Try to emit the removed events
this.$emit('event1')

What is expected?

Nothing should happen because the event listeners should have been removed.

What is actually happening?

Got "This is callback." printed in the console, which means that the event listeners are not removed as expected.


Please check my post in Vue forum for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions