Created
April 6, 2020 21:35
-
-
Save daKmoR/3c08e258705187c9ed387e505aedd5b4 to your computer and use it in GitHub Desktop.
Markdium-The evolution of open-wc scoped-elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LitElement } from 'lit-element'; | |
import { ScopedElementsMixin } from '@open-wc/scoped-elements'; | |
import { MyPanel } from './MyPanel.js'; | |
| |
export class MyElement extends ScopedElementsMixin(LitElement) { | |
static get scopedElements() { | |
return { | |
'my-panel': MyPanel, | |
}; | |
} | |
| |
connectedCallback() { | |
super.connectedCallback(); | |
| |
import('./MyButton.js').then(({ MyButton }) => | |
this.defineScopedElement('my-button', MyButton)); | |
} | |
| |
render() { | |
return html` | |
<my-panel class="panel"> | |
<my-button>${this.text}</my-button> | |
</my-panel> | |
`; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment