SOURCE

console 命令行工具 X clear

                    
>
console
const $box = document.querySelector(".box")

const $inner = document.querySelector(".inner")
// console.log($box)
const $btn = document.querySelector(".btn")

// setTimeout(() => {
//     $box.click()
// },3000)

$btn.onclick = () => {
    // $inner.click()
    $box.click()
    console.log('btn')
}
<!DOCTYPE html>
<html>
  <head>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
  </head>
  <link src="src/style.css"></link>

  <body>
    <div id="app">
      <div class="box" onclick='console.log("box")'>box
        <div class="inner" onclick='console.log("inner")'>inner</div>
      </div>
      <button class="btn"><按钮/button>
    </div>

    <script src="src/index.js"></script>
  </body>
</html>
body {
  font-family: sans-serif;
}

.box {
  width: 200px;
  height: 200px;
  background-color: aquamarine;
}

.inner {
  width: 100px;
  height: 100px;
  background-color: red;
}