<div id="app"> <button id="btn">click</button> </div> const btn = document.getElementById('btn'); btn.addEventListener('click', function(event){ event.stopPropagation();//阻止冒泡 }, false); btn.onclick = function(event) { event.stopPropagation(); }