Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
atwood-cai opened this issue Sep 13, 2017 · 0 comments

Comments

@atwood-cai
Copy link

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


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

ztlevi pushed a commit to ztlevi/vue that referenced this issue Feb 14, 2018
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant