add card component exercise
Neue Datei |
| | |
| | | <!DOCTYPE html>
|
| | | <html lang="en">
|
| | | <head>
|
| | | <meta charset="UTF-8">
|
| | | <title>Card Component</title>
|
| | | <script defer src="card-component.js"></script>
|
| | | </head>
|
| | | <body>
|
| | | <card-component>
|
| | | <!-- title and content-->
|
| | | </card-component>
|
| | | </body>
|
| | | </html>
|
Neue Datei |
| | |
| | | class CardComponent extends HTMLElement {
|
| | | constructor() {
|
| | | super();
|
| | |
|
| | | const shadowRoot = this.attachShadow({mode: "open"});
|
| | |
|
| | | shadowRoot.innerHTML = `
|
| | | <!-- style -->
|
| | | |
| | | <!-- html --> |
| | | `;
|
| | | }
|
| | | }
|
| | |
|
| | | window.customElements.define("card-component", CardComponent);
|