因为我想保持自定义元素自包含,所以我想避免在window
对象上放置对成员变量的引用。
customElements.define( 'component-one', class extends HTMLElement {
connectedCallback() {
this.memberVariable="This is a member variable";
this.innerHTML = "<button onclick='//How do I reference the above this.memberVariable here?'>This is a button</button>";
}
}):