以更可重用的方式在同一个组件中添加多个事件侦听器会更好吗?
componentDidMount: function() {
window.addEventListener('resize', this.handleVisible);
window.addEventListener('scroll', this.handleVisible);
...
},
componentWillUnmount: function() {
window.removeEventListener('resize', this.handleVisible);
window.removeEventListener('scroll', this.handleVisible);
...
},
慕姐8265434
LEATH
相关分类