利用pointer-events: none;样式控制
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>如何禁用元素和子元素的原生点击事件</title>
</head>
<body>
<div id="box" style="width: 100px;height: 100px;pointer-events: none;">
<div>点我</div>
</div>
<script>
const box = document.getElementById('box')
box.addEventListener('click',function(e){
console.log('click box')
})
box.children[0].addEventListener('click',function (e){
console.log('click button')
})
</script>
</body>
</html>