事件监听触发及销毁
#2457
Replies: 1 comment 1 reply
-
这样实现就可以 const cb = () => {}
cell.on('change:data', cb)
cell.off('change:data', cb) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
cell.on('change:Data')监听事件如果写了两次,cell.setData方法会同时触发这两个事件
cell.off也会将两个事件全部销毁
建议cell.on方法返回一个监听事件key,cell.off(type, key)可以销毁对应的监听事件
参考setTimeout,clearTimeout
Beta Was this translation helpful? Give feedback.
All reactions