神奇的handleEvent函数
<app-element></app-element> <script> customElements.define("app-element", class extends HTMLElement { constructor() { super(); this.attachShadow({ mode: "open" }); } handleEvent(event) { if (event.type === "click"){ console.log(3) } } connectedCallback() { this.shadowRoot.innerHTML = "<button>