addEventListener 事件未捕获 TypeError:e.stopPropogation 不是一个函数
2019-12-11
2098
向按钮添加事件监听器会抛出
Uncaught TypeError: e.stopPropogation is not a function
document.getElementById(`test`).addEventListener('click', (e) => this.handleOpen(e), false)
处理程序
handleOpen = e => {
e.stopPropagation()
console.log(e)
console.log(e.stopPropagation) //undefined
}
2个回答
您输入了错误的传播: https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation
stopPropagation
Rohan Bhangui
2019-12-11
拼写错误。应为 e.stopPropagation
adam tropp
2019-12-11