Improve code sample for lit integration (#991)
Align the lit component with the astro import and usage of it.
This commit is contained in:
parent
27672096f5
commit
418bc1d91c
1 changed files with 6 additions and 4 deletions
|
@ -36,13 +36,15 @@ __src/components/my-element.js__
|
||||||
```js
|
```js
|
||||||
import { LitElement, html } from 'lit';
|
import { LitElement, html } from 'lit';
|
||||||
|
|
||||||
export const tagName = 'my-counter';
|
export const tagName = 'my-element';
|
||||||
|
|
||||||
class Counter extends LitElement {
|
|
||||||
|
|
||||||
|
class MyElement extends LitElement {
|
||||||
|
render() {
|
||||||
|
return html` <p>Hello world! From my-element</p> `;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define(tagName, Counter);
|
customElements.define(tagName, MyElement);
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note that exporting the `tagName` is __required__ if you want to use the tag name in your templates. Otherwise you can export and use the constructor, like with non custom element frameworks.
|
> Note that exporting the `tagName` is __required__ if you want to use the tag name in your templates. Otherwise you can export and use the constructor, like with non custom element frameworks.
|
||||||
|
|
Loading…
Reference in a new issue