怎样区别stopPropagation()与stopImmediatePropagation()

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 09:26:18
怎样区别stopPropagation()与stopImmediatePropagation()怎样区别stopPropagation()与stopImmediatePropagation()怎样区别

怎样区别stopPropagation()与stopImmediatePropagation()
怎样区别stopPropagation()与stopImmediatePropagation()

怎样区别stopPropagation()与stopImmediatePropagation()
另外加了一个监听 stopImmediatePropagation然后再换成stopPropagation 试试就知道区别了
简而言之 stopImmediatePropagation和stopPropagation都能阻挡掉事件流中事件的冒泡
但是stopImmediatePropagation 会让当前对象(不仅parent了)的次优先级的所有监听都不执行