从原生web组件到框架组件源码(三) (2)

神奇的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>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpjsdx.html