-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
组件的destroyed方法中移除事件的方式是错误的。 #3555
Comments
QingWei-Li
added a commit
to QingWei-Li/element
that referenced
this issue
Mar 22, 2017
Fixed in #3672 |
baiyaaaaa
pushed a commit
that referenced
this issue
Mar 24, 2017
mdartic
pushed a commit
to mdartic/element
that referenced
this issue
Mar 31, 2017
caikan
pushed a commit
to caikan/element
that referenced
this issue
Apr 20, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ElementUI version
1.2.4
OS/Browsers version
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36
Vue version
2.0.0
Reproduction Link
http://jsbin.com/qukasapuha/6/edit?js,console,output
Steps to reproduce
DEMO中已有说明
What is Expected?
在组件销毁的时候能够正常移除元素绑定的事件
What is actually happening?
并没有移除。
如下代码
main.vue
dom.js
实际上,当调用ele.removeEventListener的时候, 至少需要两个参数, 如果没有传递第二个参数(handler), 将会报错。
而在
off
方法中, 传递了handler
, 但是在调用中handler为undefined
, 所以使得removeListner
方法最后接收到的参数数量是3, 从而避免了报错, 但是事件并没有被移除。当然, 元素已经被销毁了,而即便是事件正常移除, 监听器真正的被移除也是在下一下垃圾回收当中, 那么这个问题也并不是什么问题了。 这里我只是想提出这种方式的不合理之处而已。The text was updated successfully, but these errors were encountered: