Skip to content

Vue.prototype.$off(event, handler) 如果传入的handler为undefined 会删掉events数组的最后一个handler #6591

@atwood-cai

Description

@atwood-cai

Version

2.4.2

Reproduction link

http://vuejs.org

Steps to reproduce

由于错误的输入,导致的问题:
Vue.prototype.$off(eventName, handler)
vm._events[eventName]不为空,handler为undefined
会off掉vm._events[eventName]最后一个handler
在events.js 103行的位置

if (cb === fn || cb.fn === fn) {
        cbs.splice(i, 1)
        break
      }

What is expected?

x

What is actually happening?

x


当然使用者应该确保输入正确。

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